lgvlgv Posted April 9, 2012 Share Posted April 9, 2012 (edited) Hi all! Im trying to execute a program that are specified in a ini file like this but shellexecute ignore the @windowsdir or any @variable i put in, what im i doing wrong? ; Ini file [Utforskaren] exe= explorer.exe arg= , C: wrk= @WindowsDir ico= @WindowsDir & "\explorer.exe" dsc= Utforskaren the execute is from an array like this [3]|explorer.exe|, C:|@WindowsDir|@WindowsDir & "\explorer.exe"|Utforskaren ShellExecute($aIcon[$iIconIndex][0], $aIcon[$iIconIndex][1], $aIcon[$iIconIndex][2]) ConsoleWrite("! Consolewrite ->Shellexecute: " & $aIcon[$iIconIndex][0] &" | "& $aIcon[$iIconIndex][1] &" | "& $aIcon[$iIconIndex][2] & @CRLF) and result is this ! Consolewrite ->Shellexecute: explorer.exe | , C: | @WindowsDir Edited July 11, 2012 by lgvlgv Link to comment Share on other sites More sharing options...
Developers Jos Posted April 9, 2012 Developers Share Posted April 9, 2012 Try this and see if that is what you want: $t = '@WindowsDir & "explorer.exe"' ConsoleWrite('$t = ' & $t & @crlf ) $t = Execute($t) ConsoleWrite('$t = ' & $t & @crlf ) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
lgvlgv Posted April 9, 2012 Author Share Posted April 9, 2012 not sure i understand i tried this ConsoleWrite('$t = ' & $t & @crlf ) local $t = $aIcon[$iIconIndex][2] ConsoleWrite('$t = ' & $t & @crlf ) ShellExecute($aIcon[$iIconIndex][0], $aIcon[$iIconIndex][1], $t) ConsoleWrite("! Consolewrite ->Shellexecute: " & $aIcon[$iIconIndex][0] &" , "& $aIcon[$iIconIndex][1] &" , "& $t & @CRLF) but still it reads the @windowsdir as @windowsdir and not like "C:windows" ? Link to comment Share on other sites More sharing options...
lgvlgv Posted April 9, 2012 Author Share Posted April 9, 2012 this works "ConsoleWrite(@WindowsDir)" -> =C:windows but not when i get @WindowsDir from an array and put as variable. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 9, 2012 Developers Share Posted April 9, 2012 It thing I was trying to make you understand is that putting @WindowsDir in a string doesn't mean that AutoIt3 will know about this.The Execute() Function will take a literal string and assumes it contains something to Execute.in your case, you are retrieving some AutoIt3 Macro's from a INI file, which will be stored in a variable as literal string. So perform an Execute() function on that String and you will find what you are looking for.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
lgvlgv Posted April 9, 2012 Author Share Posted April 9, 2012 thxIt thing I was trying to make you understand is that putting @WindowsDir in a string doesn't mean that AutoIt3 will know about this. The Execute() Function will take a literal string and assumes it contains something to Execute. in your case, you are retrieving some AutoIt3 Macro's from a INI file, which will be stored in a variable as literal string. So perform an Execute() function on that String and you will find what you are looking for. Jos LOL, dident realize that execute was an actuall command Thank you very mutch for ur patience with me . What is the best way to use execute or stringreplace? $aIcon[$i][2]=StringReplace($aIcon[$i][2],'@WindowsDir',@WindowsDir,0,2) Regards L Link to comment Share on other sites More sharing options...
Developers Jos Posted April 9, 2012 Developers Share Posted April 9, 2012 Either way works and am not sure if there is a best way... just use the way you prefer and understand. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
lgvlgv Posted April 9, 2012 Author Share Posted April 9, 2012 thx very mutch, it so fun yet i know so little 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