obrienj Posted December 14, 2010 Posted December 14, 2010 (edited) Anybody have an example of calling a function via the contents of a variable.That is, if I have the following:local $vara $vara = Foo ; ????? what is the form of the invocation of Foo using the variable and passing a parameter ????? Func Foo($parm) ; do something with $parm return(-1) EndFuncThe question is:what is the form of the invocation of Foo using the variable and passing a parameterI tried:$rc = $vara("data")but I got syntax errors.I know how to do this in C, C++, Java and C#, but I can't seem to get it in Autoit.I have a rather large project where doing this is a requirement.Regards,Jim Edited December 14, 2010 by obrienj
spudw2k Posted December 14, 2010 Posted December 14, 2010 I think you might be over thinking it. Try this. local $varA $varA = Foo("this is a test param") msgbox(0,"$varA = ",$varA) Func Foo($parm) return MsgBox(4,"The Parameter Provided",$parm) EndFunc If you absolutely have to be able to execute a variable as a literal string, then read the help file for the Execute() function. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
trancexx Posted December 14, 2010 Posted December 14, 2010 obrienj was explaining the functionality of Call() function. local $vara $vara = "Foo" $rc = Call($vara, "data") Func Foo($parm) ; do something with $parm return(-1) EndFunc ♡♡♡ . eMyvnE
obrienj Posted December 14, 2010 Author Posted December 14, 2010 trancexx, Thank you. I knew it had to be there somewhere. Regards, Jim
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now