Jump to content

How to pass syntax check using command line parameters?


Go to solution Solved by guinness,

Recommended Posts

Posted (edited)

Very very simple script:

If $CmdLine[0] > 0 Then msgbox(0, "arg1", $CmdLine[1])

However if I run a syntax check it fails because $cmdline isn't declared. However if I try and declare it in the script I get an error saying I can't redeclare a constant.

Any advice?

Edited by kor
Posted

You can't do ...

$CmdLine[1] = 'Something'

You need to copy the $CmdLine array to a temp variable.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • Solution
Posted

Also note I am using the Au3Check that shipped with AutoIt v3.3.8.1 and I don't get any syntax error. As Au3Check is aware this is a internal constant variable.

#include <Constants.au3>

If $CmdLine[0] Then MsgBox($MB_SYSTEMMODAL, '', $CmdLine[1])

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted
  On 10/27/2013 at 11:02 PM, guinness said:

 

Also note I am using the Au3Check that shipped with AutoIt v3.3.8.1 and I don't get any syntax error. As Au3Check is aware this is a internal constant variable.

#include <Constants.au3>

If $CmdLine[0] Then MsgBox($MB_SYSTEMMODAL, '', $CmdLine[1])

I think that was my problem by not having that #include <Constants.au3>

I added that line to my existing script from my original post and name I am passing syntax checks. Thanks.

Also, I was just declaring the var, not assigning a value to it.

IE:

Local $CmdLines

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
  • Recently Browsing   0 members

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