DoctorX Posted September 4, 2005 Posted September 4, 2005 Is it possible to call a function from an external file that contains the name of the function? For example, say I have a file called "ExternalFile.txt" and the first line of the file contains the text "MyFunction". Now, what I want to do is to call a function named "MyFunction" in the script. I could do so like this... $file = FileOpen ("ExternalFile.txt", 0) $function = FileReadLine ($file, 1) FileClose $file If $function = "MyFunction" Then MyFunction () EndIf Func MyFunction () MsgBox (0, "", "MyFunction Entered") EndFunc But that seems rather redundant, and would get to be impractical when the actual external file contains many function names. What I would rather do is something like this: $file = FileOpen ("ExternalFile.txt", 0) $function = FileReadLine ($file, 1) FileClose $file $function () Func MyFunction () MsgBox (0, "", "MyFunction Entered") EndFunc Which of course, will not work but hopefully gives you an idea of what I'm trying to do. Is this possible at all? -DRX
DoctorX Posted September 4, 2005 Author Posted September 4, 2005 Ah, yes. That'll do it. Don't know how I missed that in the help file. Thanks again Alex. -DRX
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