Opened 12 years ago
Closed 12 years ago
#2789 closed Bug (Fixed)
With EndWith parameter issue
| Reported by: | jaberwacky | Owned by: | Jon |
|---|---|---|---|
| Milestone: | 3.3.13.13 | Component: | AutoIt |
| Version: | 3.3.13.1 | Severity: | None |
| Keywords: | Cc: |
Description
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
EndWith
Forum post: http://www.autoitscript.com/forum/topic/110379-autoitobject-udf/?p=1182987
Attachments (0)
Change History (4)
follow-up: 2 comment:1 by , 12 years ago
follow-up: 3 comment:2 by , 12 years ago
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:4 by , 12 years ago
| Milestone: | → 3.3.13.13 |
|---|---|
| Owner: | set to |
| Resolution: | → Fixed |
| Status: | new → closed |
Fixed by revision [10538] in version: 3.3.13.13

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"))) EndWithSeems like
.Item("A")is getting treated as a function or something, if its not enclosed in brackets.