sleepydvdr Posted November 11, 2010 Posted November 11, 2010 A while back I ran across a UDF (and have been trying to find it again but cannot) that allowed your autoit executable to take in a parameter. This particular UDF was to hide your source code inside your executable. It worked like this...Double click your executable MyProgram.exe and it works like normal.Run your executable by passing a switch like this:MyProgram.exe -extractsourcecodeand that would run FileInstall of your embedded .au3 to a predetermined location (desktop).I'm not trying to embed source code. I want to be able to make my executable to act differently with different switches passed to it. Any ideas? Thanks! #include <ByteMe.au3>
whim Posted November 11, 2010 Posted November 11, 2010 See Help file -> Using AutoIt -> Command Line Parameters
sleepydvdr Posted November 11, 2010 Author Posted November 11, 2010 Thank you for pointing me in the right direction. It took me a little bit to figure it out, so here's an example script I just wrote to help others who may have trouble figuring it out. If $CmdLineRaw = "-option1" Then MsgBox (0, "", "Your chose the first option") ElseIf $CmdLineRaw = "-option2" Then MsgBox (0, "", "The second option was chosen.") Else MsgBox (0, "", "You either used a parameter that is not recognized or ran the executable directly.") EndIf Basically, $CmdLineRaw is a built in function that retrieves what typed in after the script/executable's name. Thanks again for your help. #include <ByteMe.au3>
NiVZ Posted November 11, 2010 Posted November 11, 2010 Hello, I prefer to check if $cmdline[0] <> 0 Then Loop through all the rows in the $cmdline array NiVZ
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now