Jump to content

Innosetup with AutoIT script help needed


jben
 Share

Recommended Posts

Hi,

Has anyone here ever run their scripts through innosetup. I have recently downloaded innosetup and the ISTool, I managed to get my scripts to run through the installer I created but it doesn't wait for the installation to finish and just states the installation has finished even though my script is still running.

Anyone have any ideas how I can get innosetup to wait for the script to finish?. Thanks

Update

------

The script is an automated installation of winzip by the way (just testing)

Edited by jben
Link to comment
Share on other sites

Can you post the [Run] section of the Inno Setup script for an overview if you need further help. AFAIK, Inno Setup waits unless you set a No Wait flag.

This should wait

[Run]
Filename: {app}\file.exe

and this will not wait.

[Run]
Filename: {app}\file.exe; Flags: nowait

:)

Link to comment
Share on other sites

Here is the run section

[Run]

Filename: {tmp}\test.exe; WorkingDir: {tmp}; Flags: shellexec

As it stands I am copying this file (which is the script) to the tmp folder, and I am also copying the firefox.exe to tmp which is the original file that the script uses to automate the installation

The inno setup file works fine as far as loading the test.exe file and running the script. But the inno setup states the installation has finished even though the script is running

Edited by jben
Link to comment
Share on other sites

I just noticed that if I change the code to Filename: {tmp}\test.exe then it works.

The progress bar does show as being at the end though but I presume thats because I currently only have 1 file installing and I guess if I had 3 scripts then the progress bar would divide into 3 sections?

Is it as simple as adding more files to the run section and they will just run in order?

thanks

UPDATE

-------

Just tried updating my run section and including a second script which does seem to work. However the progress bar is still at the end.

So its semi working now and the setup wizard does wait until the script has finished before allowing the user to click finish but the progress bar just doesn't give any proper indication of progress

Edited by jben
Link to comment
Share on other sites

[Run]

Filename: {tmp}\test.exe; WorkingDir: {tmp}; Flags: shellexec

Thanks for providing the section.

ShellExec I would imagine is for running non executable files like a .txt files... I had a look at the Inno Setup Help file and it does have a flag to wait for a spawned process from ShellExec. Use the flags below

Flags: shellexec waituntilterminated

Each [Run] entry is mentioned to wait (except for ShellExec) by default. That is why a No Wait flag exists.

:)

Link to comment
Share on other sites

I have managed to get it working but is there any way I can dedicate a certain percentage of the progressbar to each part of the run section

Because currently the progress bar just goes to the end whilst the script is running and then shows the finish button once the script has finished. So if I have 3 automated scripts running they now run one after another which is cool, but the percentage bar of the setup wizard displays as 100% full, which seems a little strange

Edited by jben
Link to comment
Share on other sites

Sorry, I can not see a method of hooking into the progress bar by any simple means. The easiest option could be to create the progress bar within the AutoIt scripts and perhaps hide the wizard while the scripts run. You could even emulate the wizard windows with a Gui containing a progress control within the AutoIt scripts.

Link to comment
Share on other sites

Oh my. Why can't this just be simple.

Been trying many routes to put together this software, really not sure what I'm going to do now. I suppose at worst I could do what you said, somehow haha.

Oh i'm not sure, hurts my brain

Link to comment
Share on other sites

How about this:

[Run]

Filename: {app}\Progress.exe; Flags: nowait

Filename: {tmp}\test.exe

and then the inno setup will not wait when the progress screen appears and proceed. Then the progress screen could be a progressbar that hooks onto the autoIT scripts and increments the progressbar?

thanks

Link to comment
Share on other sites

Here is an idea that I took from the autoIT documentation. I have put a winwaitactive so that the progressbar will wait for the exe to become active, and then a winwaitclose so that the progressbar will know when the exe has finished. But as it stands this works but the progress bar goes to 100%. Is there any way I can section this code so that it only adds 10 to the progressbar because I can then expand this and add more to the progressbar and assign other software to the progressbar.

Then I could just stick this into my innosetup wizard as a run without waiting, therefore this can run whilst the software is installed. Best solution I have come up with to be honest, what do you think?

ProgressOn("Progress Meter", "Increments every second", "0 percent")

WinWaitActive ("Mozilla Firefox, Portable Edition | PortableApps.com Installer","Completing the Mozilla Firefox, Portable Edition Setup Wizard")

winwaitclose ("Mozilla Firefox, Portable Edition | PortableApps.com Installer","Completing the Mozilla Firefox, Portable Edition Setup Wizard")

For $i = 10 to 100 step 10

sleep(1000)

ProgressSet( $i,$i & " percent")

Next

ProgressSet(100 , "Done", "Complete")

sleep(500)

ProgressOff()

Link to comment
Share on other sites

How about this:

[Run]

Filename: {app}\Progress.exe; Flags: nowait

Filename: {tmp}\test.exe

and then the inno setup will not wait when the progress screen appears and proceed. Then the progress screen could be a progressbar that hooks onto the autoIT scripts and increments the progressbar?

thanks

On this idea, you could make Progress.exe like this. A coarse example but shows how it could be done.

ProgressOn("Installing", "script1")
ProcessWait("script1.exe", 2)
ProcessWaitClose("script1.exe")

ProgressSet(30, "", "script2")
ProcessWait("script2.exe", 2)
ProcessWaitClose("script2.exe")

ProgressSet(60, "", "script3")
ProcessWait("script3.exe", 2)
ProcessWaitClose("script3.exe")

ProgressSet(100, "", "finished")
Sleep(500)

The PortableApps installers have their own progress (NSIS) I believe?

Link to comment
Share on other sites

They have their own installers, this is for the purpose of an overall installer so the user can see how far the whole installation has got.

So I would have 3 scripts that install 3 apps for instance. Which would mean that each script is assigned 33%.

I come up with this idea

ProgressOn("Progress Meter", "Increments every second", "0 percent")

for $i = 10 to 100 step 10

sleep(1000)

ProgressSet( $i,$i & " percent")

WinWaitActive ("Mozilla Firefox, Portable Edition | PortableApps.com Installer","Completing the Mozilla Firefox, Portable Edition Setup Wizard")

winwaitclose ("Mozilla Firefox, Portable Edition | PortableApps.com Installer","Completing the Mozilla Firefox, Portable Edition Setup Wizard")

ProgressSet(20 & "percent")

; HERE I CAN PUT THE NEXT EXE THAT WILL INSTALL AND THEN SET PROGRESS TO 30

Next

ProgressSet(100 , "Done", "Complete")

sleep(500)

ProgressOff()

On this idea, you could make Progress.exe like this. A coarse example but shows how it could be done.

ProgressOn("Installing", "script1")
ProcessWait("script1.exe", 2)
ProcessWaitClose("script1.exe")

ProgressSet(30, "", "script2")
ProcessWait("script2.exe", 2)
ProcessWaitClose("script2.exe")

ProgressSet(60, "", "script3")
ProcessWait("script3.exe", 2)
ProcessWaitClose("script3.exe")

ProgressSet(100, "", "finished")
Sleep(500)

The PortableApps installers have their own progress (NSIS) I believe?

Link to comment
Share on other sites

Your idea looks much neater and clear. Think I will implement something like that.

Just wondering, with the code below you have stated script1.exe . Does this mean that if the script1.exe is in the same directory as the progressbar.exe then it will just recognize this?..

ProgressOn("Installing", "script1")

ProcessWait("script1.exe", 2)

ProcessWaitClose("script1.exe")

Link to comment
Share on other sites

Your idea looks much neater and clear. Think I will implement something like that.

Just wondering, with the code below you have stated script1.exe . Does this mean that if the script1.exe is in the same directory as the progressbar.exe then it will just recognize this?..

ProgressOn("Installing", "script1")

ProcessWait("script1.exe", 2)

ProcessWaitClose("script1.exe")

I suppose one thing for completnes, is there a way of the script knowing if the installation completes and if not then something will be displayed to state its not been succesful. I'm thinking that I could present something to the user and halt the installation if it fails.

In some respects I thought that my code may be able to deal with working out if the installation has been succesful as its referring to the finish page, which I could possibly use to work out if the installation has complete?

Edited by jben
Link to comment
Share on other sites

script1.exe is the name of the process. Nothing to do with location.

On your previous code, if the installs are silent (no progress), then you may do it like the below

$pid = Run('setup.exe /s')
$i = 0
While ProcessExists($pid)
    Sleep(1000)
    $i += 10
    ProgressSet( $i, $i & " percent")
    If $i = 100 Then
        ; choose to restart progress
        $i = 0
        ; or choose to wait until exit
        ProcessWaitClose($pid)
    EndIf
WEnd

For succession, you could get the exit code within the AutoIt script. Not sure if Inno Setup monitors the exit code of [Run] entries.

Link to comment
Share on other sites

Interesting. Only problem is my installs are not silent :-(

sorry for all this hassle. Just hope I can get something in place so I can expand upon it then.

Theres no reason why I cannot make them silent though as I could always display whats installing in the progressbar i suppose.

Not sure how to make stuff silent in autoIT though?

Edited by jben
Link to comment
Share on other sites

Not sure how to make stuff silent in autoIT though?

For silent installations, then you would specify defaults which your users may not want. As for switches to make silent installs, then have a look at SendToA3X as it finds switches easy using the SendTo menu.
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...