Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#3781 closed Feature Request (No Bug)

Assign and Eval, Execute, they don't work like they should when it comes to variables.

Reported by: francomaro@… Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

Assign and Eval, Execute, they don't work like they should when it comes to variables.

You cannot assign values ​​to arrays, nor values ​​when it comes to execute, nor using ByRef param.

Attachments (0)

Change History (10)

comment:1 Changed 4 years ago by anonymous

*By variables I mean sub elements of the array. As messy as it may seem to use these methods, they are useful and make things much easier.

comment:2 Changed 4 years ago by mLipok

Why you don't provide any examples ?

comment:3 Changed 4 years ago by anonymous

Eval("g_s1213[4]") = xxx

Assign("g_s1213[4]", "xxx")

Execute("g_s1213[4] = xxx")

comment:4 Changed 4 years ago by Jpm

  • Resolution set to No Bug
  • Status changed from new to closed

When you give example please make them working
here is a full test of what you want to be checked
you can see that everything is working as stated in the doc
@error is set when Eval or Assign does not conformed.
Execute work perfectly

Local $g_s1213[2] = ["0", "1"]

Local $isDeclaredArray = IsDeclared("g_s1213")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $isDeclaredArray = ' & $isDeclaredArray & @CRLF & '>Error code: ' & @error & '    Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF) ;### Debug Console

Local $sExecute = Execute("$g_s1213[1]= '1'")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sExecute = ' & $sExecute & @CRLF & '>Error code: ' & @error & '    Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF) ;### Debug Console

Local $sExecuteOK = Execute("$g_s1213[2]= '1'")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sExecuteOK = ' & $sExecuteOK & @CRLF & '>Error code: ' & @error & '    Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF) ;### Debug Console

; IsDeclared of an array element
Local $isDeclared = IsDeclared("g_s1213[1]")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $isDeclared = ' & $isDeclared & @CRLF & '>Error code: ' & @error & '    Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF & @CRLF) ;### Debug Console

; ==== check with an Array element ====
; Eval of an array element
Local $xxx = Eval("g_s1213[1]")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $xxx = ' & $xxx & @CRLF & '>Error code: ' & @error & '    Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF) ;### Debug Console

; Assign of an array element
Assign("g_s1213[1]", "xxx")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $g_s1213[1] = ' & $g_s1213[1] & @CRLF & '>Error code: ' & @error & '    Extended code: ' & @extended & ' (0x' & Hex(@extended) & ')' & @CRLF) ;### Debug Console

comment:5 Changed 4 years ago by anonymous

Please reopen this ticket, as it is the real and very annoying oversight in the language!
Jpm, you have literally completely missed the point! :D your example is kinda.. a little bit.. 100% missing the point! ok maybe 97%! coz i mean, your syntax is correct...

here's snippet that showcases the problem! Die Probleme!! La problema!! you get it.

Local $a = ['zero', 1.5, '23']

Local $result = IsDeclared('a[0]'), $err=@error, $ext=@extended
cw("--- IsDeclared('a[0]')")
cw('expecting $result to be 1 or something, but definitely not 0!')
cw('what we got: ' & $result&'! see? '&($result=0?'.... oh. it`s zero. bummer.':"it *is* 1 or something, and definitely not 0!"))
cw('$result = ' & $result&'; '&  '@err, @ext: ' & $err&', '&$ext)
cw('----------------------------------------')

Local $result = Eval('a[1]'), $err=@error, $ext=@extended
cw("--- Eval('a[1]')")
cw('what $a[1] actually is: '&$a[1])
cw('and what we got from eval:' & $result & ($a[1]=$result ? '  it is correct, good job!' : "  well... that`s... an empty string?! geez, it's not even approximately correct!... tsk tsk!!"))
cw('$result = ' & $result&'; '&  '@err, @ext: ' & $err&', '&$ext)
cw('----------------------------------------')

Local $result=Assign('a[1]', 'kvertie'), $err=@error, $ext=@extended
cw("--- Assign('a[1]', 'kvertie')")
cw("expecting $a[1] to be 'kvertie'...")
cw(($a[1]='kvertie' ? "and yay! it is: " : "but alas, here's what we got instead: ") & $a[1])
cw('$result = ' & $result&'; '&  '@err, @ext: ' & $err&', '&$ext)
cw('----------------------------------------')

exit
Func cw($text, $newline=@CRLF)
	ConsoleWrite($text & $newline)
EndFunc	

comment:6 Changed 4 years ago by Melba23

FrancoDM,

You really have proved to be an extremely unpleasant person during your short time on the forum - constantly complaining that AutoIt does not work exactly as YOU want it to do and generally insulting the Mods and Devs who volunteer to keep the forum and language alive. Best you change your tone quickly or you might find you will be unable to annoy us for a while, or perhaps ever again. The ball is in your court - so play your next shot very carefully.

As to your points here: you are basically asking for the 3 functions you mention to act on array elements as well as specific variable names. So why call it a bug? Particularly as the Help file for Assign specifically excludes array elements as arguments. As you wish it to do so it would seem more logical to have opened a "Feature request" - but no doubt our Trac system is also not working as YOU would wish. I have therefore amended the ticket for you.

M23

comment:7 Changed 4 years ago by Melba23

  • Type changed from Bug to Feature Request

comment:8 Changed 4 years ago by TicketCleanup

  • Version 3.3.15.3 deleted

Automatic ticket cleanup.

comment:9 Changed 4 years ago by anonymous

Melba, your crystal ball is broken; Also, do continue to treat the forum members with such attitude! It delightfully contributes to the characteristic... odor... that this place has acquired. And the thinly veiled threats as the icing on cake! Well done.

comment:10 Changed 4 years ago by Melba23

FrancoDM,

Not a well chosen return - and the threat was not at all veiled, as you are about to discover. Have a week to think about whether to change your attitude or leave the community. Because continuing as you are will mean you will not have a choice.

M23

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.