CommandLine$ - What it is, and what it does

by BASICwebmaster
libertyandjustice4all@gmail.com

Just completed an awesome program, and you want it to open files double-clicked from Windows Explorer, but can't figure out how to? Never fear, CommandLine$ is here! "OK, but how do I use it?", you ask. Well, that's where I come in. After you open you window/initialize your program, paste this code:

[CommandLineCheck]
if CommandLine$ = "" then wait
command$ = NoQuotes$(CommandLine$)
'put your file opening/display routine here
'command$ will contain the name of your file
wait

Here is the NoQuotes$() function, originally in FreeForm-J:

FUNCTION NoQuotes$(text$)
for x = 1 to len(text$)
   if mid$(text$, x, 1) <> chr$(34) then
      NoQuotes$ = NoQuotes$ + mid$(text$, x, 1)
   end if
next x
END FUNCTION

To see it in action, I have included a demo of CommandLine$, called 'CommandLine$.bas'. DO NOT run it from the editor, instead, tokenize and run it from Windows Explorer. I hope you like it!