PDA

View Full Version : Need help with context menu usage and OS_GetCommand



dan_moran
24-10-2008, 16:47
Greetings.

I'm having trouble with the OS_GetCommand function and I hope someone can enlighten me.

I have a script that reads a .nxf file but I am having trouble using it from the context menu. I've associated the .nxf filetype to the script with this command:

C:\thinBasic\thinBasic.exe "c:\thinBasic\UserScripts\nxf2scr.tbasic" %1

and it works fine as long as the filename does not contain a hyphen. Apparently OS_GetCommand uses a hyphen as a parsing character so the full filename doesn't get passed to the program. If I add quotes around the %1, OS_GetCommand(2) returns the full filename but it looks like now I have to strip off the quotes from the string to use it for a filename in file_ commands.

Can anyone explain how to get around the hyphen dilemma?

Thanks much.

ErosOlmi
24-10-2008, 16:53
Post moved to forum dedicated module.

I'm checking code.

ErosOlmi
24-10-2008, 17:11
First, welcome in thinBasic community forum ;)

I've checked source code and effectively we are using the following sequence of chars to determine separators or flag chars:
double quote (")
space ( )
hyphen (-)
underscore char (_)

I suppose this is quite restrictive and an imposition from our side.
For this reason I'm just developing 2 new functions:

OS_CommandsGetSep, will let you retrieve current set of chars used by OS_Commands... functions
OS_CommandsSetSep(NewSep), will let you retrieve current set of chars used by OS_Commands... functions and set your preferred one


With those new functions you will be able to adjust depending on your needs.

If you need this asap, I will be able to release this night (CET time) when back from work.

Eros

ErosOlmi
24-10-2008, 18:07
Ok, I had few minutes.

Attached in this post you will find a new version of OS module: thinBasic_OS.dll
Please download it and copy in your \thinBasic\lib\ directory replacing your current one.

I've added the following 2 functions:
CurrentSep = OS_CommandsGetSep
OldSep = OS_CommandsSetSep(NewSep)

You should be able to set the needed chars separators. Default one is: DoubleQuote + Space + Hyphen + Underscore

Let me know if all work as it should.

Ciao
Eros


PS: attached file is only for Win2K or above. It will not work for Win9x systems. It will available in double version when officially released.