Hi Mark,

I had found that on occasions the wait flag for the RUN function
didn't do the trick, particularly when the EXE launched is a
windowless process, so Friedrich showed me a clever way of using the
power of the scripting language to make sure a process had indeed
finished. In the code below I launch the Windows media player
installer in silent mode then set up a loop to periodically look to
see if the installation has completed. If it gets to Loop 4 then it
breaks the loop with a message saying the uninstall failed. The full
list of Return codes for the RUN function follows.

Run Program %_SB_INSTALLDIR%\wmpcdcs8.exe (Always Install)
Set Variable %LOOPID% to 1
Loop
Set Variable %LOOPID% to (Increment variable by 1)
Pause for "3" seconds
Set Variable %ACTIVE% to Detect Active Application(wmpcdcs8.exe)
If %ACTIVE% Equals "0" Or %ACTIVE% Equals "603" Then
Break Loop
End
If %LOOPID% Equals "4" Then
Message Box "The uninstall failed.........."
Break Loop
End
End

// Return codes are as follows:
// 0 = Process was successfully terminated (Process was not found)
// 1 = Process was found
// 603 = Process was not currently running
// 604 = No permission to terminate process
// 605 = Unable to load PSAPI.DLL
// 602 = Unable to terminate process for some other reason
// 606 = Unable to identify system type
// 607 = Unsupported OS
// 632 = Invalid process name
// 700 = Unable to get procedure address from PSAPI.DLL
// 701 = Unable to get process list, EnumProcesses failed
// 702 = Unable to load KERNEL32.DLL
// 703 = Unable to get procedure address from KERNEL32.DLL
// 704 = CreateToolhelp32Snapshot failed

Best Regards,
Geoff Spillane