Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Error: cannot assign values to constants

$
0
0

Regarding to pass a parameter/argument to my compiled .au3 ->.exe, I read the help on Command Line Parameters zillions times, but I still don't get it right.

 

my sample code is: "sample.au3"

  1. $CmdLine[0] = 1
  2. MsgBox(0, "", "The argument is " &  $CmdLine[1])

I compile to sample.exe. When I run it in DOS command line:

sample.exe "123"

I always have Autoit error message popup:

 

AutoIt error:

Error: Cannot assign values to constants

I've been search out some similar questions in this forum, some answer like:  $CmdLine[1] is a constant, can not be used as by passing in a variable.

But hey, that is my purpose. I need to pass a variable into a AutoIT compiled .exe. I need to call autoit compiled .exe and passing in a variable in my C# code. However I failed to do it even in DOS command line.

 

Again, I already read the HELP regarding "Command Line Parameters", I already search the similar topic in this forum, please help to show me how to correct my sample code make it work.
 


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>