dazza Posted March 17, 2010 Share Posted March 17, 2010 Wise People, I have a script, let's call it 'BOSS'. This is a gui that detects other scripts. It puts these in a ListView. These other scripts have many functions in them, for example: script 'alpha' has: Func alpha_step_1 Func alpha_step_3 Func alpha_step_4 How do I call these functions from BOSS without having to use the actual function name ie alpha_step_1()? Ideally, I want to: 1) grab the other script name (alpha) - easy. I get this from the _FileListToArray or the Listview 2) check there is a Func step 3 - easy. StringinStr 3) Call the Func step 3 in alpha ??? I don't think you can call a function by variable? ie $func_name = "alpha_step_3" Call $func_name Any help is much appreciated. Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 17, 2010 Share Posted March 17, 2010 First of all, it would be possible using Call, but why do you want to do that? Why not included the file and using the normal function name? 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...
dazza Posted March 17, 2010 Author Share Posted March 17, 2010 (edited) First of all, it would be possible using Call, but why do you want to do that?Why not included the file and using the normal function name?I may have 50 alpha files; each having 40 functions. Thats 2000 function calls - all hardcoded. I need to somehow use another method. Edited March 17, 2010 by dazza Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 17, 2010 Share Posted March 17, 2010 Just add those include files with #include<bla.au3> ... and then use For $i = 1 To 4 Call('_Step_' & $i) Next Func _Step_1() ConsoleWrite(1 & @CRLF) EndFunc ;==>_Step_1 Func _Step_2() ConsoleWrite(2 & @CRLF) EndFunc ;==>_Step_2 Func _Step_3() ConsoleWrite(3 & @CRLF) EndFunc ;==>_Step_3 Func _Step_4() ConsoleWrite(4 & @CRLF) EndFunc ;==>_Step_4 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...
dazza Posted March 17, 2010 Author Share Posted March 17, 2010 Just add those include files with #include<bla.au3> ... and then use For $i = 1 To 4 Call('_Step_' & $i) Next Func _Step_1() ConsoleWrite(1 & @CRLF) EndFunc ;==>_Step_1 Func _Step_2() ConsoleWrite(2 & @CRLF) EndFunc ;==>_Step_2 Func _Step_3() ConsoleWrite(3 & @CRLF) EndFunc ;==>_Step_3 Func _Step_4() ConsoleWrite(4 & @CRLF) EndFunc ;==>_Step_4 Mega BRILLIANT! And simple... like me. Many thanks Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 17, 2010 Share Posted March 17, 2010 No problem. Glad that I could help. 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