How to wait for an event during the installation
CreateInstall allows you to find and close processes, delete files, run applications, and wait until they finish during the installation. But it may happen that the installation script can not strictly detect the occurrence of the event. For example, you need to wait until the user closes some application. In this case, you must use a loop and do necessary checks at regular intervals.
In this example, we will realize the following steps. Open Notepad application, wait until the user closes it and continue the installation. Then create the file and continue the installation only when the file is removed. We will realize each of these two tasks but we will use different ways.
The presence of the running notepad.exe process will be checked by using the Check command, and organize the loop by using the Source code command and the function Sleep. Specify the checking interval as half a second in Source Code and insert the command Check inside it. The check command assigns the value of closed variable to zero if the notepad.exe process is present in the task list. The code has the following operators:
do { Sleep(500) $body$ } while !macrox_getint("closed")
Next, create a file c:\setups\delete.txt and the installation will be suspended while this file exists. Now, we will use only While Statement and Sleep commands. The While Statement command will repeat a loop until the file exists. Insert the Sleep command and specify half a second interval there that the installation doesn't overload CPU.
Project - Wait for the events
As you can see, the task waiting for an event during the installation process can be realized by simple methods.