fangjiaguo
Posts: 18
Joined: Sun Nov 09, 2008 4:12 pm

Can't move DoAction Exent up [Urgent]

Hi,

My AI version is 6.6. I met a problem that I can’t move DoAction Event up.
Do you have any method to move DoAction Event up?
(The first two events EndDialog and SpawnDialog can’t be moved down neither.)
untitled.jpg
untitled.jpg (36.19 KiB) Viewed 6461 times
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Can't move DoAction Exent up [Urgent]

Hi,

Please note that the DoAction control event doesn't necessarily have to be the first control event in the list. Even if it is the third control event, it will still be executed before the "EndDialog" control events which continue the installation. Therefore, you can leave the DoAction control event where it is now.

To make sure that the installation will not continue if the process if running, you can use the property set in the custom action in the conditions of the rest of control events. For example:

Code: Select all

EndDialog      Return      OutOfDiskSpace <> 1 AND (PROCESS <> "RUNNING")
Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
fangjiaguo
Posts: 18
Joined: Sun Nov 09, 2008 4:12 pm

Re: Can't move DoAction Exent up [Urgent]

cosmin wrote:Hi,

Please note that the DoAction control event doesn't necessarily have to be the first control event in the list. Even if it is the third control event, it will still be executed before the "EndDialog" control events which continue the installation. Therefore, you can leave the DoAction control event where it is now.

To make sure that the installation will not continue if the process if running, you can use the property set in the custom action in the conditions of the rest of control events. For example:

Code: Select all

EndDialog      Return      OutOfDiskSpace <> 1 AND (PROCESS <> "RUNNING")
Regards,
Cosmin
Sorry, I can't quite agree with you. I have done a test.
test.JPG
test.JPG (23.81 KiB) Viewed 6383 times
I added two UI Custon Action:DetectAIRunningOrNot & ShowMsgIfRunning.
The vbscripts for them are:
DetectAIRunningOrNot

Code: Select all

Dim objWMIService, objProcess, colProcess
Dim strComputer
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process")

Session.Property("PROCESS")="NOT RUNNING"
For Each objProcess in colProcess
if objProcess.Name = "AdvancedInstaller.exe" then
   Session.Property("PROCESS")="RUNNING"
End If
Next
ShowMsgIfRunning

Code: Select all

MsgBox Session.Property("PROCESS")
When I try to run the aip with Advanced Installer running, it pops up a message bos with text "RUNNING"(is correct!), and when I click the button on the message box, the installation continues even if the process is running. So I am so confused.Here is my aip project:
t.zip
(59.75 KiB) Downloaded 521 times
[/i]
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Can't move DoAction Exent up [Urgent]

Hi,
when I click the button on the message box, the installation continues even if the process is running.
Please note that the condition you added to the first control event should be added to the rest of the predefined control events. I gave only the first control as an example so you can see how to set the condition. Please add the (PROCESS <> "RUNNING") condition to the rest of predefined control events and let me know if the installation still continues.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
fangjiaguo
Posts: 18
Joined: Sun Nov 09, 2008 4:12 pm

Re: Can't move DoAction Exent up [Urgent]

I will try now :)
fangjiaguo
Posts: 18
Joined: Sun Nov 09, 2008 4:12 pm

Re: Can't move DoAction Exent up [Urgent]

I'm so sorry that the installation still continues after I added PROCESS <> "RUNNING" to the rest of predefined events.
test2.JPG
test2.JPG (33.68 KiB) Viewed 6385 times
fangjiaguo
Posts: 18
Joined: Sun Nov 09, 2008 4:12 pm

Re: Can't move DoAction Exent up [Urgent]

I think the execution sequence of events is the list order of the events.
At first, PROCESS is not "RUNNING" and is not "NOT RUNNING. So the EndDialog's condition is satisfied. Then the DoAction DetectAIRunningOrNot is executed, and PROCESS is set to "RUNNING"(if AI is running). So the message box pops up with "PROCESS" text. And when I click OK, the installation continues.

Am I right?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Can't move DoAction Exent up [Urgent]

Hi,

Please try initializing the "PROCESS" property with "RUNNING" in the "Install Parameters" page. It seems that if the property is not initialized, the installation continues.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
fangjiaguo
Posts: 18
Joined: Sun Nov 09, 2008 4:12 pm

Re: Can't move DoAction Exent up [Urgent]

I think first we should make an agreement that the execution sequence is related with the list sequence. So if PROCESS is initialized with "RUNNING", the first EndDialog Event's condition is not satisfied. The installation won't continue. However, if it's actually not running, the installation should have continued. So it's still a bug. The only way is moving the Detect Evevt before EndDialog Event.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Can't move DoAction Exent up [Urgent]

Hi,
I think first we should make an agreement that the execution sequence is related with the list sequence.
Yes, it is. However, the NewDialog (EndDialog) and SpawnDialog control events are treated a bit differently. The ControlEvent Table article in the MSDN states:

"The installer starts each event in the order specified in the Ordering column."

"The exception is that each control can publish a most one NewDialog or one SpawnDialog event. If multiple NewDialog and SpawnDialog control events are selected for the same control, only the event with the largest value in the Ordering column gets published when the control is activated."

The only way is moving the Detect Evevt before EndDialog Event.
I moved the DoAction control events before the EndDialog ones (I edited the AIP) and I attached the project to this post. This should fix all the problems related to the execution order.

Regards,
Cosmin
Attachments
t.zip
(61.76 KiB) Downloaded 312 times
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
fangjiaguo
Posts: 18
Joined: Sun Nov 09, 2008 4:12 pm

Re: Can't move DoAction Exent up [Urgent]

It's wonderful and how do you make it?
And I can't quite understand what means the largest value.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Can't move DoAction Exent up [Urgent]

Hi,
how do you make it?
First I changed the default conditions of the predefined control events so they can be added in the AIP file (otherwise they were retrieved from a resource file). After that, I opened the AIP with a text editor and in the "caphyon.advinst.msicomp.MsiControlEventComponent" component I modified the Ordering attributes of the control events. If the ordering is correct and two control events do not have the same order, the project will be modified successfully.
And I can't quite understand what means the largest value.
The largest value means the highest order number. For example, the last event in the list has the highest order number (the first event has the lowest one).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”