Jump to content

Whats wrong with this


Recommended Posts

select
    case $cmdline[0] = 0 ; check to see if there is a parameter
        msgbox(0, "GUI Menu", "")
    Case $CmdLine[1] = "/?"
        MsgBox(0, "Switche Index","")
    Case $Cmdline[0] = 2
         $Cmdline[1] = "/Product"
         $Var = $Cmdline[2]
        MsgBox(0,"",$Var)
EndSelect
Exit

I Keep getting an error:

Line 7:

$Cmdline[1] = "/Product"

^Error

Error: Cannot assign values to constants.

Link to comment
Share on other sites

  • Developers

select
    case $cmdline[0] = 0 ; check to see if there is a parameter
        msgbox(0, "GUI Menu", "")
    Case $CmdLine[1] = "/?"
        MsgBox(0, "Switche Index","")
    Case $Cmdline[0] = 2
         $Cmdline[1] = "/Product"
         $Var = $Cmdline[2]
        MsgBox(0,"",$Var)
EndSelect
Exit

I Keep getting an error:

Line 7:

$Cmdline[1] = "/Product"

^Error

Error: Cannot assign values to constants.

You cannot assign your value to the commandline variable..

What is it you want to accomplish ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hi,

Just delete the silly line...?

select
    case $cmdline[0] = 0 ; check to see if there is a parameter
        msgbox(0, "GUI Menu", "")
    Case $CmdLine[1] = "/?"
        MsgBox(0, "Switche Index","")
    Case $Cmdline[0] = 2
         if $Cmdline[1] = "/Product" then    $Var = $Cmdline[2]
        MsgBox(0,"",$Var)
EndSelect
Exit
Link to comment
Share on other sites

Ok this worked perfect but now I realized I'm going to be needing it to recognize 3 switches and having the third be the variable

setup.au3 /Product Group1 $var

I've read the cmdline reference a million times but I can't get the hang of it. how do I get two command line parameters and a third being a $var like the above post.

Link to comment
Share on other sites

Ok this worked perfect but now I realized I'm going to be needing it to recognize 3 switches and having the third be the variable

setup.au3 /Product Group1 $var

I've read the cmdline reference a million times but I can't get the hang of it. how do I get two command line parameters and a third being a $var like the above post.

Maybe I see your confusion. You don't use the $CmdLine array to pass parameters OUT, only for seeing them coming IN. Any old variable can be used to pass parameters out to another script (or another instance of the same script):

$var = '"My Third Parameter"'
Run("AutoIt3.exe setup.au3 /Product Group1" & $var)

:rolleyes:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...