Opened 10 years ago

Closed 10 years ago

#2789 closed Bug (Fixed)

With EndWith parameter issue

Reported by: jaberwacky Owned by: Jon
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:


Sorry for the title.

The following code demonstrates an issue with using parameters using With/EndWith. If the second parameter is not acessed directly but instead accessed by With then the function fails. Wow, I really don't have an elegant way to describe this. Let's let the example, which I haven't run, (provided by FaridAgl) speak for itself.

Global $oDictionary = ObjCreate("Scripting.Dictionary") 

$oDictionary.Add("A", "Value of A") 

With $oDictionary     
  MsgBox(0, .Count, $oDictionary.Item("A")) ;Doesn't fails     
  MsgBox(0, .Count, .Item("A")) ;Fails     
  MsgBox(0, $oDictionary.Count, .Item("A")) ;Fails too

Forum post:

Attachments (0)

Change History (4)

comment:1 follow-up: Changed 10 years ago by Synix <…>

I found out this doesn't fail:

With $oDictionary     
  MsgBox(0, .Count, $oDictionary.Item("A"))    
  MsgBox(0, .Count, (.Item("A")))   
  MsgBox(0, $oDictionary.Count, (.Item("A")))

Seems like .Item("A") is getting treated as a function or something, if its not enclosed in brackets.

comment:2 in reply to: ↑ 1 ; follow-up: Changed 10 years ago by Synix <…>

Forget my guess about the cause, it's something totally different.
It seems like, if a function call has two object parameters in a row it won't work in many cases. In some it does. Putting one of the parameters in brackets often fixes this, but you sometimes need to find out which one.
I couldn't find out more.

comment:3 in reply to: ↑ 2 Changed 10 years ago by Synix <…>

*two or more

comment:4 Changed 10 years ago by Jon

  • Milestone set to
  • Owner set to Jon
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [10538] in version:

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

as closed The owner will remain Jon.

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

Note: See TracTickets for help on using tickets.