Jump to content

Recommended Posts

Posted

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!

Posted

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])

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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?

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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