Jump to content

[SOLVED] some help with shellexecute!


Recommended Posts

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 by lgvlgv
Link to comment
Share on other sites

  • Developers

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

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

  • Developers

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

thx

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

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

  • Developers

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...