Jump to content

Reading AutoIT Commandlines from ini-File


 Share

Recommended Posts

Hello all,

i´m shure you could bring a little light into the dark and help me with my problem.

I´m working on a project to build a simple wrapper for our software-deployment. The script is supposed to show a small gui that waits for user input when to install new software and executes the steps of the installation afterwards.

The gui is working pretty good and i came up with the idea to write all installation-commands into a separate ini-file. That way, i only have to write my sourcecode into the ini and do not have to compile the wrapper again for every new piece of application.

my ini-file ISG_SCCM_Setup.ini has this section:

[installsteps]
Install first application=RunWait(@Scriptdir&'\setup.exe /S')
Install second application=RunWait(@Scriptdir&'\msiexec.exe /i someapp.msi /q')
Do some cleanup=Filedelete(@Programfilesdir&'\Someapp\text.txt')

Using this code, i read the steps of installation and execute them afterwards, showing a small messagebox to the user:

$installsteps = IniReadSection(@ScriptDir& "\ISG_SCCM_Setup.ini", "installsteps")
For $i = 1 To $installsteps[0][0]
execute($installsteps[$i][1])
MsgBox(1,'Status','Status of '&$installsteps[$i][0]&' is '&$Return)
Next

Problem is that the string from the ini isn´t interpreted completely when i execute the corresponding step. The command isn´t "RunWait('msiexec.exe /i C:\Temp\someapp.msi /p')", it tries to run the command "as is", without filling in the @Scriptdir-variable.

Does someone know a way how to workaround this problem?

Best case would be to be able to write a whole line of autoit code into one line of the installsteps-section, like for example:

If @OSLANG=0407 Then Runwait('msiexec.exe /i '&@scriptdir&'\someapp.msi /Transforms='&@scriptdir&'\German_language.mst /q')
Edited by Gargamel
Link to comment
Share on other sites

You're thinking about it wrong. You don't want your script to be able to execute arbitrary code on whim.

I did something similar, use a delimiter and then read the ini file

step1=installer,exe,@Scriptdir&'\setup.exe /S'

step2=installer,msi,someapp.msi /q

step3=filedelete,@Programfilesdir&'\Someapp\text.txt'

Then loop through each section and parse each part of the string and pass on the parameters to an internally written function.

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

  • Recently Browsing   0 members

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