Jump to content

Recommended Posts

Posted

After I have compiled my exe I will be running it in a command window. What I want to achieve is almost the same as the now.exe if you know it.

c:\>now.exe Hello

Will return the date and time plus the "Hello". ie (09:30 - 14/04/08 Hello) in the command window. So I want my script/exe to look at the command line I type to run it and then set the argument "Hello" or what ever to a variable so that the exe will be able to use it.

Thanks in advance

Posted

Hi MarkVR,

c:\>now.exe Hello

Will return the date and time plus the "Hello". ie (09:30 - 14/04/08 Hello) in the command window.

Try this:

If $CmdLine[0] > 0 Then
    $var = $CmdLine[1]
    ConsoleWrite(@HOUR & ":" & @MIN & " - " & @MDAY & "/" & @MON & "/" & StringRight(@YEAR, 2) & " " & $var)
    Exit
EndIf
Henry
Posted (edited)

This will cover it as long as you have only one parameter:

If $CmdLine[0] > 0 Then
    $Var = $CmdLine[1]
EndIf

Thank you

And thx Henry

Edited by MarkVR
Posted

Ahh ok the consolewrite does not seem to work. This is how I did it thanks again for the input:

If $CmdLine[0] > 0 Then

$argument = $CmdLine[1]

EndIf

$Date = _DateTimeFormat( _NowCalc(),2)

$Time = @HOUR&":"&@MIN

$Output = $Date& " - "& $Time

run(@ComSpec &" /k echo " &$Output &" - " & $argument)

Posted (edited)

Try to add this on the beginning:

#AutoIt3Wrapper_Change2CUI=y

Edit:

Also, what do you mean "does not seem to work"? Can you explain the issue? Is there an error generate when you perform compile?

Edited by henry1
Henry

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