tilb Posted March 2, 2007 Share Posted March 2, 2007 (edited) Hello, Can I execute some code which is stored in a variable ? Execute function is not too complete (I can't execute RegWrite.... for example) I want to use it in a compiled script. Thanks, Florian Edited March 2, 2007 by tilb Link to comment Share on other sites More sharing options...
Creative Posted March 2, 2007 Share Posted March 2, 2007 (edited) I'm not sure, but I don't think that you can do it directly. You can use conditionals to do it though. $codeToRun = 'RegWrite("key")' Select Case StringInStr($codeToRun, "RegWrite") $codeToRun = StringTrimRight(StringTrimLeft($codeToRun, 9), 1);isolate arguements for function Local $givenArguements = StringSplit($codeToRun, ",");split each arguement Select Case $givenArguements[0] == 4 RegWrite($givenArguements[1], $givenArguements[2], $givenArguements[3], $givenArguements[4]) Case $givenArguements[0] == 3 RegWrite($givenArguements[1], $givenArguements[2], $givenArguements[3]) Case $givenArguements[0] == 2 RegWrite($givenArguements[1], $givenArguements[2]) Case $givenArguements[0] == 1 RegWrite($givenArguements[1]) Case Else MsgBox(0, "Error", "Invalid number of arguements for RegWrite");EDIT...missing arguements EndSelect EndSelect The only issue is that this way, you'd have to write one out for every individual command that you'd like to be able to read. Edited March 14, 2007 by Creative "Everything is vague to a degree you do not realize till you have tried to make it precise." - Bertrand Russell [The Philosophy of Logical Atomism] Link to comment Share on other sites More sharing options...
nfwu Posted March 4, 2007 Share Posted March 4, 2007 (edited) I want to use it in a compiled script.No problemo! Just check out the helpfile and you'll be on your way. AutoIt specific command Line Switches Form1: AutoIt3.exe [/ErrorStdOut] [/AutoIt3ExecuteScript] file [params ...] Execute an AutoIt3 Script File /ErrorStdOut Allows to redirect fatal error to StdOut which can be captured by an application as Scite editor. This switch can be used with a compiled script. To execute a standard AutoIt Script File 'myscript.au3', use the command: 'AutoIt3.exe myscript.au3' Form2: Compiled.exe [/ErrorStdOut] [params ...] Execute an compiled AutoIt3 Script File produced with Aut2Exe. Form3: Compiled.exe [/ErrorStdOut] [/AutoIt3ExecuteScript file] [params ...] Execute another script file from a compiled AutoIt3 Script File. Then you don't need to fileinstall another copy of AutoIT3.exe in your compiled file. Form4: AutoIt3.exe [/ErrorStdOut] /AutoIt3ExecuteLine "command line" Execute one line of code. To execute a single line of code, use the command: Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi!'')"') The tray icon will not be displayed when using /AutoIt3ExecuteLine NOTE: Correct usage of single- and double- quotation marks is important, even double single. What you are looking for is this lineRun(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi!'')"') #) Edited March 4, 2007 by nfwu TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
tilb Posted March 13, 2007 Author Share Posted March 13, 2007 Hello, Thank you for your answer, Is there already a script that do what creative says ? Thanks Florian 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