Jump to content

Recommended Posts

Posted

Hello again!

I was wondering if I can pass arguments to my script via a switch on the exe I compile?

ie:

CODE

$ANSWER=1

If x not null then

$ANSWER = x

end if

SCRIPT.EXE -5

Can I pass the switch (-5) to the script (to equal x in this case)?

Thanks!

Newbie

Posted

Hi..

Passing an argument to the script is not the problem.

If you look in the helpfile for: $CmdLine .. its an array with all arguments in it..

you use it like:

if $CmdLine[0]= 0 Then                         ;if there is no argument
FileWriteLine($file,"Error: no .ini file found");write error 
Exit(1)                                                  ;and exit
else                                                         ;else
$inifile=$CmdLine[1]                                 ;save first argument in variable
EndIf
Posted

Hi..

Passing an argument to the script is not the problem.

If you look in the helpfile for: $CmdLine .. its an array with all arguments in it..

you use it like:

if $CmdLine[0]= 0 Then                          ;if there is no argument
FileWriteLine($file,"Error: no .ini file found");write error 
Exit(1)                                                    ;and exit
else                                                        ;else
$inifile=$CmdLine[1]                                ;save first argument in variable
EndIf

<{POST_SNAPBACK}>

Thank you very much.

if $CmdLine[0] = 0 then
    $ANSWER = 1 else
    $ANSWER = $CmdLine[1]
end if

Very good!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...