Jump to content

runwait and shellexecutewait aren't waiting


kwantum
 Share

Recommended Posts

Hello,

I am trying to write an autoit script to install software. The software installation is a silent install that runs setup.exe with some parameters.

It runs fine from a cmd prompt and with a batch script. I am converting to autoit so the installation media can be downloaded and extracted to the correct place and eliminate a lot of user error in this process.

I have one autoit script that downloads the media and extracts the zip. That script calls a helper autoit script. The helper script has

#RequireAdmin.

$instparms = " /s /v"

ShellExecuteWait("C:\Temp\setup.exe", $instparms)

I have tried using our old batch script with shellexecutewait. The script keeps running and doesn't wait. I have a pop up at the end to report if the install succeeded or failed. As soon as the zip file uncompresses and the helper script is called, I get the pop up saying the install failed.

I also tried runwait and and processwaitclose. In task manager I can see setup.exe and the helper script still running.

I can get the script to work by adding in sleeps but I would prefer not to go that route.

Any ideas?

Thank you

Link to comment
Share on other sites

kwantum,

See this thread.  Applies if you are running the script from SciTE.

kylomas

edit: Don't know of a workaround.  Search the forums.  I'm sure this has come up before.

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

@kwantum, welcome to the AutoIt forum.

9 hours ago, kwantum said:

In task manager I can see setup.exe and the helper script still running.

so the helper script is obviously working correctly. now, i assume the pop-up message is displayed by the master script; in that case, the master script should be calling the helper script also using a RunWait() or similar statement.

also, beware of UAC issues - i advise you run the master script as admin, at least for testing. also read this topic carefully:

 

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

On ‎10‎/‎13‎/‎2017 at 2:08 AM, kosamja said:

If it doesnt work that means your process starts another and then exits, instead of runwait use run, processwaitclose, processlist and then check for parent process pid.

Thank you! I was able to get the script to wait for the helper script to work. In the main script I use shellexecutewait to call the helper script. The helper script has #requireadmin. That combination, elevates to admin and waits for the helper script to complete before returning to the main script.

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