Command-line arguments: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 983: | Line 983: | ||
print( i," ", arg[i] ) |
print( i," ", arg[i] ) |
||
end</lang> |
end</lang> |
||
=={{header|M2000 Interpreter}}== |
|||
function quote$("a") return "a" a string in "" |
|||
Arguments in command line maybe two kinds, in first part those three letters identifiers with + or - for switches for interpreter and the last part to executed before loading the actual script. |
|||
For this example we make a script, save to temporary directory, and call it passing arguments. We can use Win as shell substitute in M2000 environment, or the Use statement. Reading the shell statement Win we can see how the command line composed. We call the m2000.exe in the appdir$ (application directory, is the path to M2000.exe), and pass a string as a file with a path. That path will be the current path for the new start of m2000.exe the host for M2000 Interpreter (an activeX dll). |
|||
<lang M2000 Interpreter> |
|||
Module Checkit { |
|||
Document a$ = { |
|||
Module Global A { |
|||
Show |
|||
Read a$="nothing", x=0 |
|||
Print a$, x |
|||
A$=Key$ |
|||
} |
|||
A: End |
|||
} |
|||
Dir temporary$ |
|||
Save.doc a$, "program.gsb" |
|||
\\ open if gsb extension is register to m2000.exe |
|||
Win quote$(dir$+"program.gsb") |
|||
\\ +txt is a switch for interpreter to use string comparison as text (not binary) |
|||
\\ so we can send switches and commands before the program loading |
|||
Win appdir$+"m2000.exe", quote$(dir$+"program.gsb +txt : Data {Hello}, 100") |
|||
\\ no coma after name (we can use "program.gsb" for names with spaces) |
|||
Use program.gsb "From Use statement", 200 |
|||
\\ delete file |
|||
Wait 5000 |
|||
Dos "del "+quote$(dir$+"program.gsb"); |
|||
\\ open directory |
|||
Rem : Win temporary$ |
|||
} |
|||
Checkit |
|||
</lang> |
|||
=={{header|Mathematica}}== |
=={{header|Mathematica}}== |