Jump to content

Recommended Posts

Guest JohnHood
Posted

I'm trying to get the autoit variable $var to replace the info in quotes.

Run( @SystemDir & "\msiexec.exe /I program.msi" )

I need to be able to run three programs in series. Not always the same program, hence the INI.

I tried:

EnvSet("ENVAR", $var)

Run(@COMSPEC " /c Start %ENVAR%")

Basically, I can't figure out how to get @comspec to read an AutoIt variable.

  • Developers
Posted (edited)

I'm trying to get the autoit variable $var to replace the info in quotes.

Run( @SystemDir & "\msiexec.exe /I program.msi" )

I need to be able to run three programs in series.  Not always the same program, hence the INI. 

I tried:

EnvSet("ENVAR", $var)

Run(@COMSPEC " /c Start %ENVAR%")

Basically, I can't figure out how to get @comspec to  read an AutoIt variable.

; EnvSet("ENVAR", $var) don't think you need this..
Run(@COMSPEC " /c Start " & ENVAR)
Edited by JdeB

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.
  :)

Posted

To read a Key/Value in an INI file, you can use the "IniRead()" function (check the doc). Here's a code snippet:

$var = IniRead("C:\myfile.ini", "section2", "key")

; Use "&" to concatenate strings
Run(@ComSpec & " /c Start " & $var)

Hope this helps!

=MX=

Guest johnhood
Posted

Worked perfectly! thank you!

Guest johnhood
Posted

OK one more and I'll stop bugging you:

Command line is {the name of the script,} {the name of the ini file to read}.

$ini = $CmdLine[1]

It gets this, I can Echo the $ini variable correctly

But:

$var = IniRead("& $ini &", "launch", "1", "NotFound")

Always comes back "not found"

tried this:

$var = IniRead(" & $ini & ", "launch", "1", "NotFound")

and this:

$var = IniRead($ini, "launch", "1", "NotFound")

and this:

$var = IniRead(" & $ini & ", "launch", "1", "NotFound")

What am I doing wrong?

  • Developers
Posted (edited)

This is the correct version....

$var = IniRead($ini, "launch", "1", "NotFound")

are you sure that the INI is in the same directory as the default path or are you supplying the whole path to the ini file ??

Edited by JdeB

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.
  :)

Guest Johnhood
Posted

I didn't that was why it wasn't going.

:D

Thanks again

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...