robhagemans / pcbasic

PC-BASIC - A free, cross-platform emulator for the GW-BASIC family of interpreters
http://www.pc-basic.org
Other
399 stars 48 forks source link

Windows 10 makes INI file hard to access #35

Closed robhagemans closed 6 years ago

robhagemans commented 7 years ago

moved from https://github.com/robhagemans/robhagemans.github.io/commit/532e6c3f051024e14ccaf6aa725ffba88fe3ddff#commitcomment-21778772

This is not the place for my comments, but this is the first place I found that might get a response from Rob. Your PC-BASIC looks like it will allow me to continue to use my 35 year old programs. Great! the problem I have is the limit on printing. I cannot get the print-trigger=page option to work. I am using windows 10. I found and made changes to the INI file. Nothing seems to have effect. I went so far as to put the options in the Defailt file, still no change. I m unable to start PCBASIC from my command prompt either. Any Help? I have joined GitHub as BigJoe3, Thanks

robhagemans commented 7 years ago

Hi Joe,

Thanks for your interest - to be able to help, I need a bit more information:

Thanks Rob

BigJoe3 commented 7 years ago

I use a program I wrote back in the 80s for my monthly church auction. I need to print invoices both during the sale and of course at the end. I am trying to get the print option to process as soon as a page is completed. I have noted that the control codes I use for my line printer will not work on my newer HP printer I have connected via my local network. The following program is what I am using to test the function of the option.

10 PRINT"This program will try to print 3 pages of numbered lines." 20 FOR X = 1 TO 3 30 FOR Y = 1 TO 55 40 LPRINT "page "X" line "Y 50 NEXT Y 60 NEXT X 70 PRINT"done"  This is the INI file in my roaming DIR. I note that when I open the location of PC-BASIC, it shows \local\ rather than roaming.

PC-BASIC private configuration file.

Edit this file to change your default settings or add presets.

Changes to this file will not affect any other users of your computer.

[pcbasic] print-trigger=page run=auction.txt

Use the [pcbasic] section to specify options you want to be enabled by default.

See the documentation or run pcbasic -h for a list of available options.

for example (for version '15.08.11'):

allow-code-poke=False

altgr=True

append=False

aspect=4,3

border=5

caption=PC-BASIC

capture-caps=False

cas1=

cga-low=False

codepage=437 ; choices: 1258, 437, 720, 737, 775, 806, 850, 851, 852, 853, 855, 856, 857, 858, 860, 861, 862, 863, 864, 865, 866, 868, 869, 874, 932, 934, 936, 938, 949, 950, Georgian-academy, Georgian-ps, Iransystem, Kamenicky, Mazovia, alternativnyj, armscii8a, big5-2003, big5-hkscs, iscii-as, iscii-be, iscii-de, iscii-gu, iscii-ka, iscii-ma, iscii-or, iscii-pa, iscii-ta, iscii-te, koi8-r, koi8-ru, koi8-u, mik, osnovnoj, pascii, ruscii, russup3, russup4ac, russup4na, viscii

com1=

com2=

config=

convert=

copy-paste=left,middle ; choices: left, middle, right, none

ctrl-c-break=True

current-device=Z

debug=False

dimensions=None

double=False

exec=

font=unifont,univga,freedos ; choices: cga, cgathin, freedos, mda, olivetti, tandy1, tandy2, unifont, univga, vga

fullscreen=False

help=False

input=

interface= ; choices: , none, cli, ansi, text, graphical

keys=

load=

logfile=

lpt1=PRINTER:

lpt2=

lpt3=

map-drives=False

max-files=3

max-memory=65534,4096

max-reclen=128

monitor=rgb ; choices: rgb, composite, mono

mono-tint=255,255,255

mount=

nobox=False

nokill=False

nosound=False

output=

pcjr-term=

peek=

pen=left ; choices: left, middle, right, none

print-trigger=page

quit=False

reserved-memory=3429

resume=False

run=

scaling=smooth ; choices: smooth, native, crisp

serial-buffer-size=256

shell=none

state=

strict-hidden-lines=False

strict-newline=False

strict-protect=False

syntax=advanced ; choices: advanced, pcjr, tandy

text-width=80 ; choices: 40, 80

utf8=False

version=False

video=vga ; choices: vga, ega, cga, cga_old, mda, pcjr, tandy, hercules, olivetti

video-memory=262144

wait=False

To add presets, create a section header between brackets and put the

options you need below it, like this:

[your_preset]

border=0

You will then be able to load these options with --preset=your_preset.

If you choose the same name as a system preset, PC-BASIC will use your

options for that preset and not the system ones. This is not recommended.

BigJoe3 commented 7 years ago

Note, you probably know, all the large bold print lines are preceded by a hash-tag (#)

robhagemans commented 7 years ago

Does the run=auction.txt option work? I.e. when you start PC-BASIC, does it automatically run the program? I'm trying to determine whether it can actually find the INI file.

robhagemans commented 7 years ago

Another thing - what happens if you add this:

55 LPRINT CHR$(12)
BigJoe3 commented 7 years ago

No, it does not run my auction.txt program. The CHR$(12) is used in my Auction program, but it only results in a small heart shaped character being printed and then the data for the next page begins. I can work around that by keeping track of the lines printed.

robhagemans commented 7 years ago

It seems maybe the INI file is not found at all. What is the full path of the INI file on your computer?

BigJoe3 commented 7 years ago

I tried copying the INI file to the appdata\local dir, then to appdata\local\pcbasic and finally to appdata\local\pcbasic\data (where the default file resides), all with the same result

BigJoe3 commented 7 years ago

C:\Users\joe\AppData\Roaming\pcbasic is the path

robhagemans commented 7 years ago

The file you make changes to should be the one in \AppData\Roaming, changing the files in Local or changing the default file won't have an effect. You also do need the CHR$(12) form-feed character as PC-BASIC does not know how many lines fit on the page - it's the form-feed that should trigger the print.

Can you try starting from the Windows command prompt with the --print-trigger=page option? That way we can determine whether the issue is with the INI file or with the option.

BigJoe3 commented 7 years ago

I have had a problem starting pcbasic from the command prompt. I'll try again, but if you could tell me if I need to put a path name before pcbasic, that might help.

BigJoe3 commented 7 years ago

I tried starting it from c:\users\joe and get the reply pcbasic is not recognized as an internal or external command...

BigJoe3 commented 7 years ago

Finally, I was able to get somewhere. I used the path c:\users\joe\appdata\local\pc-basic>. When I entered the command pcbasic --print-trigger=page, the screen displayed the window for pcbasic and then collapsed it, reporting "file not found"

BigJoe3 commented 7 years ago

If I enter just pcbasic, the same thing happens. ERROR: File not found

robhagemans commented 7 years ago

OK, apparently it is picking up one of your INI files and trying to run a file that's not there. Try

pcbasic --print-trigger=page --run=

with nothing after the run= option - that should avoid it trying to run anything

BigJoe3 commented 7 years ago

GREAT! That brought up the pcbasic window, but I couldn't load my program. It did not find any of them. I wrote a quick program to test the page print function and it worked! I can move my programs now and try to make a new shortcut to run pcbasic. Are you familiar with the chr that is printed when I issue the CHR$(12) command and is there a way to supress it?

BigJoe3 commented 7 years ago

I have to go out for the day. I will check back later. Thanks so much for all your help.

robhagemans commented 7 years ago

OK, so it seems it works, but PCBASIC doesn't see your INI file. As a workaround you could of course create a new shortcut or add the options to the existing shortcut.

To identify the issue with the INI files, I think it would be best to first delete the existing edited ones and to put the default file back in its original state, and then experiment with the file in the AppData\Roaming location only.

I'm not sure how Windows 10 treats that location as I don't have a Windows 10 machine to try it on. It seems to work OK in Windows 7. However, some versions of Windows make this location hidden, (which is very annoying, since Microsoft actually recommend this as the location for configuration files!). So you may need to unhide it first.

I don't know of a way to suppress a character being printed for CHR$(12) - it's supposed to be a form-feed control character but not all printers/operatng systems may treat it that way...

BigJoe3 commented 7 years ago

Windows 10 will not allow changes to be made to its shortcuts. I found the INI file that I could get pcbasic to load, it was the one I copied to appdata\local\pcbasic. I created a sub-dir Auction, and put my program there. Then changed the options to run from the sub-dir and all seems OK for now. I will run further tests later. Windows 10 hides the appdata dir, but once you open it, you can move through the dir tree just fine. I created a new shortcut to be placed on my desktop. I compared it with the one generated by the download of your pcbasic. I think the problem is that windows 10, in hiding the appdata folder, didn't allow your shortcut to complete properly. The target was the same, but the "Start in" location truncated the path after %user profile%. If someone else runs into this problem, have them check the properties of their shortcut for the "Start in" location. Again, thanks for all the help. I do have an idea that I would like to write my own online/live auction program, but I know GWBASIC is not the way to go there. I had a copy of Basic For Windows from Richard Russel across the pond. but his documentation was a bit to complicated for me to follow. Do you have any suggestions? I did have some success using Russels B4W, but lost my copy when I had a major crash on my home system, just a week after my wife broke her laptop (where I kept my backups)! If you know of a language that is similar to basic, but will access windows applications, let me know.

robhagemans commented 7 years ago

Hi, thanks for the background. I'm glad it works now. I'll have to check if I can make this more intuitive in Windows 10, but I would need to be able to try it on that OS which is currently not an option.

As for BASIC-like development platforms for Windows, what comes to mind is Microsoft's VB.NET which is freely available as part of .NET - I think Visual Studio Community or whatever they call it now has development tools for it.

robhagemans commented 6 years ago

Can't reproduce on Windows 10 - the INI fle shortcut is accessible and changes to the file can be saved and are seen by PC-BASIC. The "start in" location is the user home folder, which is OK.