Jump to content

Recommended Posts

Posted

Is there a way to use an array value in place of an actual property name in a script? I have 10 properties that I want to read and I've stored them in an array called: $Property.

Now I want to loop through a for/next loop and display each of the properties as shown below:

$Property = _ArrayCreate("property1", "property2", "property3")
$oId3 = ObjCreate("CDDBControl.CddbID3Tag")
for $i = 0 to UBound($Property)
    $fld = $oId3.$Property[$i]
    msgbox(1,"Property=",$fld)
next

When I do it now, I get: ERROR: syntax error

$fld = $oId3.$Fields

I also tried $old3. & $Fields[$i] and a few different cases with quotes. Still no luck.

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Posted

I dont know but I think you might be looking for

$old3.$Fields[$i] = $Property[$i]

Maybe answer? Sorry if it's not I havn't played with COM all that much yet.

Posted

Is there a way to use an array value in place of an actual property name in a script? I have 10 properties that I want to read and I've stored them in an array called: $Property.

Now I want to loop through a for/next loop and display each of the properties as shown below:

$Property = _ArrayCreate("property1", "property2", "property3")
$oId3 = ObjCreate("CDDBControl.CddbID3Tag")
for $i = 0 to UBound($Property)
    $fld = $oId3.$Property[$i]
    msgbox(1,"Property=",$fld)
next

When I do it now, I get: ERROR: syntax error

$fld = $oId3.$Fields

I also tried $old3. & $Fields[$i] and a few different cases with quotes. Still no luck.

Shesh... you're making my head hurt...

How about this:

for $i = 0 to UBound($Property) - 1
    $fld = Eval("$oId3." & $Property[$i])
    msgbox(1,"Property=",$fld)
next

Note the Eval and the "- 1" on the For loop.

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

Posted

Shesh... you're making my head hurt...

My head already hurts. I tried your suggestion, but it appears that $oID. has to be followed by the literal property or method rather than a "stand-in". Maybe someone else out there knows of a "trick" to make it work. I'll keep trying, and I can always do it the long way which results in 12 times as much code... B)
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Posted

$old3.$Fields[$i] = $Property[$i]
Well, unfortunately, the values in $Fields are more like "red", "blue", "green". That is, they are not predictable, so they themselves can't be incremented... B)
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Posted

I thought I remembered answering this question before -- sorry, it is execute, not eval you want to use. See here: Using variables with COM manipulation?

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

Posted

I thought I remembered answering this question before -- sorry, it is execute

You got it! That worked great. Thank you...
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

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