Jump to content

Recommended Posts

Posted

Hi all,

I'm calling my script from the DOS.

When I call the exe, I want to send also a value for a variable of my scrypt... which is the best pratice to follow?

Many thanks for all in advance.

Posted

Example :

Save Exitvalue.au3 and Call-Exitvalue.cmd to a directory of your choice. Compile Exitvalue.au3 and start the exe with the cmd file.

Global $g_sValue, $g_sParam1

$g_sParam1 = "empty"
If $CMDLINE[0] Then
    $g_sParam1 = $CMDLINE[1]
EndIf

$g_sValue = InputBox("Test", "enter a number between 1 and 99 : ", "0")
MsgBox(4096, "", "Parameter = " & $g_sParam1 & @CRLF & "%ERRORLEVEL% = "& $g_sValue)
Exit($g_sValue)

 

@echo off
echo starts Exe with Parameter and displays the Returnvalue
echo.
cd %~dp0
Exitvalue Parameter1
echo %ERRORLEVEL%
pause

Small hint :
You can also predefine command line parameters within SciTE when developing your script (Press SHIFT F8).

Call-Exitvalue.cmd Exitvalue.au3

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...