Sign in to follow this  
Followers 0
MHz

COM Dictionary property Item is not writable

4 posts in this topic

#1 ·  Posted (edited)

Here is an issue if using Com with a Dictionary object. In brief summary, a Dictionary object can store any data type. Similar as to a collection, it store Keys and Items. These Key and Items can be Added, Read, Written and removed.

The Item property supports Read and Write while the Key property is Write only. The issue is with the Write ability of both Item and Key properties. This could be regarded as a Bug of AutoIt Com, or a feature that has not been implemented yet. So I will add it here for review.

Some basic examples

VBScript write to the Item property

Dim oDict
Set oDict =  CreateObject("Scripting.Dictionary")
If IsObject(oDict) Then
    oDict.Add "One", "Same"
    oDict.Item ("One") = "Changed" 'write
    MsgBox oDict.Item ("One")
End If

AutoIt write to the Item property

Global $oDict
$oDict =  ObjCreate('Scripting.Dictionary')
If IsObj($oDict) Then
    $oDict.Add ('One', 'Same')
    $oDict.Item ('One') = 'Changed' ;write
    MsgBox(0, '', $oDict.Item ('One') )
EndIf

VBScript works with the write while AutoIt does not. "Changed" should be the result shown in the MsgBox of both. Neither ot the above examples give error and seems like the " = 'Changed' " is completely ignored by AutoIt.

Trying to write to a Key property will only produce an error with AutoIt.

Any reason why Write (sometimes refered as to Set) to a Dictionary property is not achievable with AutoIt Com? Or perhaps any other property write without prior check if possible?

:whistle:

Edit:

Changed to valid comment character in VBScript example.

Edited by MHz

Share this post


Link to post
Share on other sites



*Bump*

Time for another review for help on this. :whistle:

Share this post


Link to post
Share on other sites

*Bump*

Time for another review for help on this. :whistle:

I played around with this for a bit when you first posted it. I see nothing wrong with it and tossing in .value onto the objects didn't change anything (as it did with another COM problem recently worked). Assuming it works in VBS, then I'd suggest moving this to a bug and see if Sven can take a look at it.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Thankyou Dale for your time spared to look at this issue, along with anyone else who did. I have posted this issue in the Bug Forum here so it can move forward to hopefully being fixed.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0