Jump to content
Sign in to follow this  
JRSmile

dynamic com object methods?

Recommended Posts

JRSmile

Hi there i have new private project about an api wrapper, BUT i have the following problem too:

Func test($username = "JRSmile", $apikey = "aa72a3b1161d33d0eba36f986fa1fb43")
    $f = ObjCreate("pocketXMLRPC.Factory")
    $user = $f.Proxy("http://ws.audioscrobbler.com/2.0/", "user.")
    $mystruct = ObjCreate("PocketXMLRPC.Struct")
    $mystruct.user = $username
    $mystruct.api_key = $apikey
    $r = $user.getlovedtracks($mystruct)
    $mystruct = 0
    $f = 0
    $r = StringReplace($r, '\"','"')
    Return _XMLLoadXML($r)
EndFunc   ;==>test

this is the example of a func i use, the problem is that i can't change the line:

$r = $user.getlovedtracks($mystruct)

to something like this:

$r = $user.$method($mystruct)

is it somehow possible to do dynamic method calls?

Best regards,

J.


$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])))''Chr("a")&"HI"Next;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)

Share this post


Link to post
Share on other sites
PsaltyDS

You could try Execute(), but I doubt that works either way.

:o

Edit: Proven wrong again... sigh.

:D

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
JRSmile

SOLVED:

$method = "getlovedtracks"
    $r = Execute("$user."&$method&"($mystruct)")
Edited by JRSmile

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])))''Chr("a")&"HI"Next;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)

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  

×