Sign in to follow this  
Followers 0
masonje

pass variable to .exe script

4 posts in this topic

How do I execute an autoit script that looks like this...

Dim $t

MsgBox(0, "test", $t)

...then I want to run it with a statement something like...

test.exe $t="Jon"

...I know that does not work, but I'm sure there is some way. I looked through the documentation, but couldn't find it. I'm sure I just wasn't looking for the right key words.

Thanks,

MasonJE

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If you have something like 'test.exe $t="Jon"' run. There is a var $CmdLine[0] that will be set to 1 and $CmdLine[1] will be set to '$t="Jon"'... In the helpfile look up command line parameters.

[edit]

Added quotes.

Edited by gamerman2360

Share this post


Link to post
Share on other sites

heres an example

; Command Line decompile to desktop
; Author Skruge

If $CMDLine[0] > 0 Then
      If $CMDLine[1] = "/decompile" Then GetSource()
  EndIf
  
; Main Code Here
  
  Func GetSource()
      FileInstall("MyScript.au3", @DesktopDir &  "\")
      Exit
  EndFunc ;==>GetSource

and the syntax would be

"myprogram.exe /decompile"

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

$CMDLine[1] = "/decompile"...

"myprogram.exe /decompile"

That was exactly what I was looking for. Thanks a tun! :P

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0