Jump to content

Error - Cannot assign values to constants


Go to solution Solved by mLipok,

Recommended Posts

Posted (edited)

What this mean ?

Does anyone previously met with such a problem ?
Anyone knows a solution ?

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "z:\Au3\MyScript.au3" /UserParams   
+>12:23:16 Starting AutoIt3Wrapper v.2.2.0.3 SciTE v.3.4.1.0   Keyboard:00000415  OS:WIN_XP/Dodatek Service Pack 3  CPU:X64 OS:X86    Environment(Language:0415)
+>         SciTEDir => C:\Program Files\AutoIt3\SciTE   UserDir => C:\Documents and Settings\Administrator\Ustawienia lokalne\Dane aplikacji\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Documents and Settings\Administrator\Ustawienia lokalne\Dane aplikacji\AutoIt v3\SciTE
>Running Tidy (2.4.1.6)  from:C:\Program Files\AutoIt3\SciTE\tidy
+>12:23:25 Tidy ended.rc:0
>Running AU3Check (3.3.10.2)  from:C:\Program Files\AutoIt3  input:z:\Au3\MyScript.au3
+>12:23:34 AU3Check ended.rc:0
>Running:(3.3.10.2):C:\Program Files\AutoIt3\autoit3.exe "z:\Au3\MyScript.au3"   
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
...
..
...
..
...
..
"Z:\TOOLs\Macro\KK_SQL.au3" (3) : ==> Cannot assign values to constants.:
Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123
Global Enum ^ ERROR

EDIT:

"Z:TOOLsMacroKK_SQL.au3" is one of my include file.

The most interesting is the fact that if I move a declaration of those enumerated constants to the main script, to the beginning, then all the problems disappear.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Hi there,

Your code or part of your code would be usefull

problem with Includes maybe?

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Posted

Without code, I would give this advice:

A constant contains a value and can never be changed.

A variable can contain a value that can be changed.

So you are declaring a constant, and then trying to change it after declaring... can't be done.

Please correct me if I am wrong in any of my posts. I like learning from my mistakes too.

Posted

I know.
It is a little big , confusing and written a long time ago script.
Therefore, even for me as the author he is often problematic.
For now, I'm just asking.
Following the problem for several days. Tonight I will be analyzed in depth.
But I ask because maybe someone had a similar problem and somehow can show me the correct way.

When I find the pixie, then of course I will write a relationship with hunting.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

What is the code from line 1 - 3 on "Z:TOOLsMacroKK_SQL.au3" ?

Please correct me if I am wrong in any of my posts. I like learning from my mistakes too.

Posted

I am unfamiliar with that error message.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)
  On 6/4/2014 at 10:34 AM, MrBeatnik said:

Without code, I would give this advice:

A constant contains a value and can never be changed.

A variable can contain a value that can be changed.

So you are declaring a constant, and then trying to change it after declaring... can't be done.

 

I do not use this const I mean:

$iSQL_PodstawoweDaneAdresowe_Nazwa123

EDIT: this const name was changed be me specialy to be sure it is not used everywhere in my scirpt

I can rename them form example:

"Z:\TOOLs\Macro\KK_SQL.au3" (3) : ==> Cannot assign values to constants.:
Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik
Global Enum ^ ERROR
Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 6/4/2014 at 10:42 AM, MrBeatnik said:

What is the code from line 1 - 3 on "Z:TOOLsMacroKK_SQL.au3" ?

 

I do another test:

here is 3 first line:

Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik1
Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik2
Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik3

and output:

"Z:\TOOLs\Macro\KK_SQL.au3" (1) : ==> Cannot assign values to constants.:
Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik1
Global Enum ^ ERROR

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 6/4/2014 at 10:48 AM, mLipok said:

 

I do another test:

here is 3 first line:

Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik1
Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik2
Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik3

and output:

"Z:\TOOLs\Macro\KK_SQL.au3" (1) : ==> Cannot assign values to constants.:
Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik1
Global Enum ^ ERROR

 

I don't get this issue.

Const Enum in my include works fine:

test1.au3:

#include <test2.au3>
msgbox(0,"End test", "Complete")

test2.au3:

Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik1
Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik2
Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik3
msgbox (0,"Include Works","No errors detected")
Edited by MrBeatnik

Please correct me if I am wrong in any of my posts. I like learning from my mistakes too.

Posted

and it is the funniest thing: hunt down a bug

funniest I mean in developing programs

find a bug and remove it
PRICELESS

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Maybe send me a ZIP of your files and I can have a look for you? PM me.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • Moderators
Posted

mLipok,

Same offer here. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

thanks for the offers.

But wait a moment I have solution.
Error usual routine as it is sometimes stems from nescience, in this case of my ignorance.

The issue is related with #include-once

I do a repro in few minutes an all will be clear.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

  On 6/4/2014 at 11:22 AM, Melba23 said:

mLipok,

Same offer here. :)

M23

Oi, to the back of the queue Melba23! :)

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • Moderators
Posted

guinness,

At once, o mighty and powerful Dev person! :sweating:;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Solution
Posted (edited)

Eliminating mistakes everyone learns. Today again I've learned something.

Just one time, to one UDFa, I added to this script at the beginning of the new variables

And just look in attachment what happened ;)

EDIT: ANSWER: recursion

include-once.ZIP

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

That's why I have never seen that error because I always add #include-once to the very top of the script regardless of whether or not I am using Jos' directives. It's at least good to know for the future. Thanks mLipok.

 

  On 6/4/2014 at 11:31 AM, Melba23 said:

guinness,

At once, o mighty and powerful Dev person! :sweating:;)

M23

Better!

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)
  On 6/4/2014 at 11:39 AM, guinness said:

regardless of whether or not I am using Jos' directives.

 

which one directive?

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 6/4/2014 at 11:41 AM, mLipok said:

which one directive?

I meant #include-once goes above #AutoItWrapper_* directives always in my scripts.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted
  On 6/4/2014 at 11:42 AM, guinness said:

I meant #include-once goes above #AutoItWrapper_* directives always in my scripts.

 

Do you add them to all UDF - include files ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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