Sign in to follow this  
Followers 0
AcidCorps

Whats wrong with this

10 posts in this topic

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.

Share this post


Link to post
Share on other sites



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 ?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Something like this?

; ...

Case $CmdLine[0] = 2 And $CmdLine[1] = "/Product"

; ...

Share this post


Link to post
Share on other sites

well in another post I asked how to use the commandline to create a $var and I got this as a response

$Var = $CmdLine[2]

it worked for another script but I can't get it to work for this one.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Problem is that you're trying to SET the value of the $CommandLine constant. That you cannot do...

Share this post


Link to post
Share on other sites

ok thank you

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Good example. :rolleyes:

Share this post


Link to post
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
Sign in to follow this  
Followers 0