RunProgram - using variables

Just starting out? Need help? Post your questions and find answers here.
calypso
User
User
Posts: 14
Joined: Sun Mar 26, 2023 7:23 am
Location: Vancouver BC Canada

Re: RunProgram - using variables

Post by calypso »

when I place r1 = RunProgram.......... the one that works returns 1 and the one that does not returns 0 meaning it did not launch.
None of that matters anymore, I found the cause of the problem I was having.
It was @Luis reply about encoding that made me check the Notepad encoding when the txt file was saved.

My input list file is created in Notepad.exe
the file was saved as UTF-8 with BOM Encoding.
I will try other Encoding options in Notepad in the following order.
ANSI
UTF-16LE
UTF-16BE
UTF-8
UTF-8 with BOM

Well, Well, Well...
First try saving text file with ANSI Encoding and I no longer have any problem. VNC launches same as when it worked using text typed in PB.
Who would have thought.. It sure took me a long time to figure that one out.
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: RunProgram - using variables

Post by luis »

Told you my idea of asking about your file was not so insane :wink:

Also if you remember I told you to compare the two variables looking directly at their memory contents and not just "visually".
They looked alike but evidently they were not.

Anyway, all is well that ends well, even if by reading the other problems you have with PB a call to an exorcist may be advisable.
"Have you tried turning it off and on again ?"
A little PureBasic review
calypso
User
User
Posts: 14
Joined: Sun Mar 26, 2023 7:23 am
Location: Vancouver BC Canada

Re: RunProgram - using variables

Post by calypso »

@mk-soft

Re: Whether I still want to learn a new prog language at 72, I don't know.
Will support you in any case ;)
How did you start programming?

Thanks to all who tried to help.

In answer to mk-soft question I started programming in 1977-78ish using CP/M and Digital Research macro assembler at a time when Microsoft only had a basic interpreter. We had custom computers at work for machine control and the software provided by supplier developers had bugs. I used the DR Macro assembler to create libraries of macros used to generate code for different computers, cross-assemblers I guess. We originally had programs and data stored on paper tape (ugh!) and used a high speed mechanical paper tape reader and punch and ASR-33 Teletype at 100 Baud to edit the paper tape and create a new one. A co-worker and myself developed an interface board to connect a 8080 Microcomputer to the larger custom (non-Dec) computer and developed supporting software to replace the reader/punch pair with a S-100 bus based microcomputer. We ditched the mechanical teletype and used a 9-inch monochrome CRT display and ran Electric Pencil as a full screen video editor. I did a lot in assembler for several years. I started the first dial-up bulletin board system in Canada, Third in North America. The first one being in Chicago started by (Ward Christensen and Randy Seuss). The second in Atlanta Georgia and a public FTP site in Detroit run by Randy Petersen. Microsoft used a DEC PDP-10 to cross assemble code for the 8080 and subsequent processors. The early years of computing was a great time mostly because i was still in my mid to late 20's. I did a lot of coding in Digital Research CBASIC (I think), I can't really remember the name. My work changed to more of a support and advisor role so my coding became sparse and I had a young family.
I didn't have a computer at home from 1983-1992 so I missed out a lot on all the innovations. I only had a chance to use them at work. I have worked with Free BSD, Linux, MS-DOS and Windows since it first came out. No Apple products though as we had none at work. I never made money like Paul Allen and Bill Gates because I was working for someone else and not my own business. when you have a family with Children one needs a steady income and cannot take risks. The rest is history. I have been with the same employer since 1973 when I was 23 years old and grew up in the computer revolution.

Funny thing is that I am still working for the same employer at 72 but planning to retire in 2024. As far as coding in later years, I had to learn how to use VB6 and GUI forms to fix bugs in someone else's work, that was a about 6 years ago. About the same time I found PureBasic and PureVision. I like it now because I can write and test in windows and then recompile on a Linux box where things run great,and it's fairly inexpensive with a great user base and forum. For me PB is much more readable than Perl which i also had to deal with.

Just last year I got into using Raspberry Pi 3B's running Pi-Star OS and driving Touchscreen HMI color displays. I use them as hot-spots connected to the internet to allow me to talk to radio amateurs in different parts of the world. I do have my advanced Amateur Radio Certification in Canada. So after Retirement I will carry on with computer and radio hobbies. My current computer is 8 years old so I am waiting for PCIe 5.0 to be more readily available and GPU cards dropping in price before my probably last upgrade.

I deal mostly with machine testing, data and control and sometimes write small apps to help users in their work automating stuff.
Old people tend to talk too much, I write too much because I have no one to talk to right now, they are all sleeping.
I have always been a night person due to many years of shift work.

I am so happy now that I can continue to write the rest of the program I am working on. I do it in bits, testing and debugging procedure one at a time before I put it all together.

Cheers to all who bothered to read my history and thanks again for the help. I am based in the Greater Vancouver area in British Columbia, Canada.

Recommended reading: The Idea Man By Paul Allen - Available in soft cover on Amazon. They were used Teletypes too!

Stephen
AZJIO
Addict
Addict
Posts: 1312
Joined: Sun May 14, 2017 1:48 am

Re: RunProgram - using variables

Post by AZJIO »

Above you were suggested to check the variable.

Code: Select all

Debug "-" + VNC$ + "-"
Perhaps it was not clear why. If you are reading a path from a file, then you get #CRLF$ at the end of the line. As a result, your path contains 2 extra characters, and with the above test, you will see this. I usually use a vertical character.

Code: Select all

Debug "|" + VNC$ + "|"
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: RunProgram - using variables

Post by luis »

AZJIO wrote: Mon Mar 27, 2023 4:52 pm As a result, your path contains 2 extra characters, and with the above test, you will see this. I usually use a vertical character.
ReadString() does not return the #CRLF$ at the end of the line, you do not end with two extra characters in the string.
The problem here was he was reading the BOM (U+FEFF) at the start of the file as part of the string.
Looking at the string hovering on it inside the debugger, or printing it with debug is not going to show that unicode char and all seems well.
He could have seen it in the memory buffer by using ShowMemoryViewer().
"Have you tried turning it off and on again ?"
A little PureBasic review
Post Reply