Moderators SmOke_N Posted December 15, 2014 Moderators Posted December 15, 2014 (edited) I think where you might be confused is when assigning a variable a function name from within your script. eg. Global $ghCWrite = ConsoleWrite $ghCWrite("This is a test" & @CRLF) That assigns a pointer or object reference to the variable $ghCWrite for the function ConsoleWrite. Retrieving strings from a file (or any string for that matter) is not setting a pointer/object to the variable, it's setting a string. To assign it, you could probably get away with (run this in a separate test file): Global $gszFRead = FileRead(@ScriptFullPath) Global $gaFuncs = StringRegExp($gszFRead, "(?i)(?:^|\v)[\s\w]*func\s*(\w+)\s*\(", 3) Global $ghMyFunc = TestCaseOne ConsoleWrite(VarGetType($ghMyFunc) & @CRLF) For $iFunc = 0 To UBound($gaFuncs) - 1 $ghMyFunc = Execute($gaFuncs[$iFunc]) ; assign the pointer/object to $ghMyFunc ConsoleWrite(VarGetType($ghMyFunc) & @CRLF) $ghMyFunc() ; call the func Next Func TestCaseOne() MsgBox(0, 0, "Case One") EndFunc Func TestCaseTwo() MsgBox(0, 0, "Case Two") EndFunc Otherwise, use the Call() method I've discussed above. Edited December 15, 2014 by SmOke_N fixed parenthesis calling func Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
mikell Posted December 15, 2014 Posted December 15, 2014 @SmOke_N '(?im)(?:^|.*s)Funcs*(w+)' gets the volatile funcs
Moderators SmOke_N Posted December 15, 2014 Moderators Posted December 15, 2014 (edited) @SmOke_N '(?im)(?:^|.*s)Funcs*(w+)' gets the volatile funcs Yes, but it also gets commented out lines or string quotes from continuation lines as well .. I use similar methods when writing obfuscators. Edited December 15, 2014 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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