RedneckTech Posted August 13, 2012 Share Posted August 13, 2012 Ive been trying this and the only sensible way i can come up with is as follows$CmdLine[0] = 1 If $CmdLine[1] = "/F" Then MsgBox (0, "", "The Command has been forced") ElseIf $CmdLine[1] = "/L" Then MsgBox (0, "", "The Log has been activated") Else MsgBox (0, "", "No lines Detected, Try again dude!") EndIfHave Also Tried this:$CmdLine[0] = 2 $CmdLine[1] = "/F" $CmdLine[2] = "/L" If $CmdLine[1] = "/F" Then MsgBox (0, "", "The Command has been forced") ElseIf $CmdLine[1] = "/L" Then MsgBox (0, "", "The Log has been activated") Else MsgBox (0, "", "No lines Detected, Try again dude!") EndIfUnfortunately, when I "Run" myscript.exe /F or myscript.exe /L I get "Error: Cannot assign values to constants."Any advice?And i came up with this after reading the help file, and searching the forums, so please dont just send me back to that help file pageThanks in advance! Link to comment Share on other sites More sharing options...
Skitty Posted August 13, 2012 Share Posted August 13, 2012 Ive been trying this and the only sensible way i can come up with is as follows $CmdLine[0] = 1 If $CmdLine[1] = "/F" Then MsgBox (0, "", "The Command has been forced") ElseIf $CmdLine[1] = "/L" Then MsgBox (0, "", "The Log has been activated") Else MsgBox (0, "", "No lines Detected, Try again dude!") EndIf Have Also Tried this: $CmdLine[0] = 2 $CmdLine[1] = "/F" $CmdLine[2] = "/L" If $CmdLine[1] = "/F" Then MsgBox (0, "", "The Command has been forced") ElseIf $CmdLine[1] = "/L" Then MsgBox (0, "", "The Log has been activated") Else MsgBox (0, "", "No lines Detected, Try again dude!") EndIf Unfortunately, when I "Run" myscript.exe /F or myscript.exe /L I get "Error: Cannot assign values to constants." Any advice? And i came up with this after reading the help file, and searching the forums, so please dont just send me back to that help file page Thanks in advance! That's not how you pass the command line params, $CmdLine is a predefined constant, you can't assign a value to it in the way shown in those scripts, you pass them by running the compiled version of your script something like Run(@ScriptDir & "program.exe /f"). If $CmdLine[0] > 0 then MsgBox(0,'',$CmdLine[1]) Link to comment Share on other sites More sharing options...
water Posted August 13, 2012 Share Posted August 13, 2012 To test you can set the parameters in SciTE (Shift+F8) and then run the script using F5. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
RedneckTech Posted August 13, 2012 Author Share Posted August 13, 2012 Ok, Im really lost now... my problem is that i was telling $cmdline[0] how many params it was allowed to be? so if i send 14 different params to the exe $cmdline[0] is automatically set to 14? and $cmdline[x>0] goes to whatever param i put in at that position? Link to comment Share on other sites More sharing options...
water Posted August 13, 2012 Share Posted August 13, 2012 so if i send 14 different params to the exe $cmdline[0] is automatically set to 14? and $cmdline[x>0] goes to whatever param i put in at that position?Correct, correct. But make sure that x is <= $cmdline[0] when checking the parameters. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
RedneckTech Posted August 13, 2012 Author Share Posted August 13, 2012 thanks guys. again, I have made things WAYYYY harder than they need to be.... why do i always do this to myself? see my earlier pose about InputBox()... Link to comment Share on other sites More sharing options...
water Posted August 13, 2012 Share Posted August 13, 2012 As I'm sure you wont't make a "mistake" twice your coding improves over time (that happend to most of us here) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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