TerrorByter Posted June 24, 2012 Share Posted June 24, 2012 Im trying to make a compiled exe from a script with the ability to run command line switches... From what I understand from the help file and examples on this forum, Ive made the script, but its not working like it needs to. Ive obviuosly misunderstood something from what ive read in the help file, and other examples ive looked through on this forum. Could someone please help me fix this, or explain to me what Im doing wrong. The complied exe will be called modechange.exe, the command lines Im trying are "modechange.exe /game" or "modechange.exe /ent" and "modechange.exe /aud" Here is my script... so what am I doing wrong? Forgive me if Im being stupid, but I obviously just dont understand it very well. If CmdLine["game"] Then funcgame ElseIf CmdLine["ent"] Then funcent ElseIf CmdLine["aud"] Then funcaud EndIf Exit func (funcgame) Local $var1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AZMSu.exe", "") Local $var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MdSwtchu.exe","") Run ($var1) Run ($var2) WinActivate ("Mode Switcher") WinWaitActive("Mode Switcher") ControlClick ("[CLASS:CTModeSwitcherClass]", "", 24003, "primary", 2, "", "") EndFunc Exit func (funcent) Local $var1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AZMSu.exe", "") Local $var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MdSwtchu.exe","") Run ($var1) Run ($var2) WinActivate ("Mode Switcher") WinWaitActive("Mode Switcher") ControlClick ("[CLASS:CTModeSwitcherClass]", "", 24001, "primary", 2, "", "") EndFunc Exit func (funcaud) Local $var1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AZMSu.exe", "") Local $var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MdSwtchu.exe","") Run ($var1) Run ($var2) WinActivate ("Mode Switcher") WinWaitActive("Mode Switcher") ControlClick ("[CLASS:CTModeSwitcherClass]", "", 24002, "primary", 2, "", "") EndFunc Exit Link to comment Share on other sites More sharing options...
JohnOne Posted June 24, 2012 Share Posted June 24, 2012 (edited) If CmdLine[0] > 0 ThenFor $i = 0 to Ubound(CmdLine) -1ConsoleWrite(CmdLine[$i] & @LF)NextEndifArrays have index numbers Edited June 24, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
TerrorByter Posted June 24, 2012 Author Share Posted June 24, 2012 Ok thanks for the help... let me see if I can apply that. As for accessing the help file, trust me im doing that, I wouldnt have come up with the rest of the script if I wasnt reading the help file. My problem isnt "not reading"... my problem is "not understanding"... Link to comment Share on other sites More sharing options...
JohnOne Posted June 24, 2012 Share Posted June 24, 2012 I can see that lol, I never mentioned the help file. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
TerrorByter Posted June 24, 2012 Author Share Posted June 24, 2012 Ahhh... lol... its your signature that I mistook at a hint to go READ =P But I think ive got it now... I used the example by "water" on another thread If $CmdLine[0] = 0 Then Exit MsgBox(16, $sTitle, "No parameters passed!") If $CmdLine[1] = "/?" Then ConsoleWrite("Help follows here ..." & @CRLF) If $CmdLine[1] = "/dir" Then RunWait("test2.exe /dir C:temp*.exe") Seems to be working like a charm for me ^^ Link to comment Share on other sites More sharing options...
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