litlmike Posted October 12, 2006 Share Posted October 12, 2006 Question:Possible to Concatenate a Function's Name? Meaning, can I append a variable at the end of a Function? Note: Trying to avoid If Statements as a work-aroundExample:User Selects options A, B, or C. Then, the according Function is run:Example_A ()Example_B ()Example_C ()So then, can I make the Function look like?:; Below is the Function Name Example with its trailing option of A, B, or C. Example_ & $option ()Thanks In Advance. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 12, 2006 Share Posted October 12, 2006 Hi, sorry, but for what? Why not the easy way? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
litlmike Posted October 12, 2006 Author Share Posted October 12, 2006 Ha! I was thinking this was the easy way... In short, I would have to write another function for the If statements. Which, is not the end of the world, but in this instance it was easier to concatenate, than write another If Func. If I have to write the If statements I can, but out of curiousity is it possible to do this? _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Helge Posted October 12, 2006 Share Posted October 12, 2006 $func = "B" Call("Example" & $func) Func ExampleA() MsgBox(64, "", "A") EndFunc Func ExampleB() MsgBox(64, "", "B") EndFunc Func ExampleC() MsgBox(64, "", "C") EndFunc Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 12, 2006 Share Posted October 12, 2006 Hi, $input = InputBox("A,B,C", "") Call("Example_" & $input) Func Example_A() MsgBox(0,"","A") EndFunc Func Example_B() MsgBox(0,"","B") EndFunc Func Example_C() MsgBox(0,"","C") EndFunc So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
litlmike Posted October 12, 2006 Author Share Posted October 12, 2006 Hi, $input = InputBox("A,B,C", "") Call("Example_" & $input) Func Example_A() MsgBox(0,"","A") EndFunc Func Example_B() MsgBox(0,"","B") EndFunc Func Example_C() MsgBox(0,"","C") EndFunc So long, Mega Ahhh, yes I see what you mean....Thanks for the feedback. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 12, 2006 Share Posted October 12, 2006 Ahhh, yes I see what you mean....Thanks for the feedback. HI, no problem. And I thought, it would be easier to do it like this: Example(InputBox("A,B,C", "")) Func Example($input) Switch $input Case "A" MsgBox(0, "Func: " & $input, "A") Case "B" MsgBox(0, "Func: " & $input, "B") Case "C" MsgBox(0, "Func: " & $input, "C") EndSwitch EndFunc ;==>Example So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
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