Detect Service and abort or run Custom Action

Having trouble running Advanced Installer? Got a bug to report? Post it all here.

Detect Service and abort or run Custom Action

Postby ntdoc » Thu Aug 27, 2009 1:56 am

I see that there is the ability to check if a service is running and abort install here: http://www.advancedinstaller.com/user-g ... rvice.html

What I'd like to do though is detect if a service is running and if a process is running and if they are not run my Custom Action, but if they're not running then I'd like to proceed and run the Custom Actions. I've looked around some in the help file and the site here but don't see such an example, but maybe I'm not searching on the correct term.

If there is an article you can point me to or explain how I can do that I would greatly appreciate it. Thanks.
ntdoc
 
Posts: 6
Joined: Fri Aug 21, 2009 2:59 am

Re: Detect Service and abort or run Custom Action

Postby GabrielBarbu » Thu Aug 27, 2009 11:56 am

Hello,

Here is a comprehensive article on how to detect or stop a process. Both the tutorial on how to detect a service and how to detect a process store the results in a property. The "detect service" one stores its result in AI_SERVICE_STATE and the "detect process" one sets the AI_PROCESS_STATE property. You can use the following condition on your Custom Action:
Code: Select all
(   (AI_SERVICE_STATE="Stopped") OR (AI_SERVICE_STATE="Not Found")   ) AND (AI_PROCESS_STATE = "Stopped")

This will only run your custom action if neither the process nor service are running.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
GabrielBarbu
 
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am

Re: Detect Service and abort or run Custom Action

Postby altgene » Tue Apr 27, 2010 2:32 am

I am struggling to understand where to configure the above action. I looked at the tutorial and at this post, but have no idea of where the custom action has to go in the UI.

Would you be able to pull together a set of images required to check the status of a service, e.g. "Background Intelligent Transfer Service", and start or stop this Windows service? Alternatively, could you provide the AIP script snippet?

Many thanks!
altgene
 
Posts: 1
Joined: Tue Apr 27, 2010 1:10 am

Re: Detect Service and abort or run Custom Action

Postby GabrielBarbu » Tue Apr 27, 2010 8:06 am

Hello and Welcome to Advanced Installer Forums,

You can place your custom actions wherever you need them on the Custom Actions page. Simply create one under Install. The custom action will execute, store it's value in one of the properties mentioned in my previous post. Another custom action will be launched or not depending on the value of these properties. To achieve this, use the Condition field on the custom action's property pane found to the right. Lower on the pane there is a Condition field that determines whether the custom action should be run or not.

Since you are new to Advanced Installer, I highly recommend you read all our tutorials. Should you find this too time consuming, you can read simple and professional tutorials. These two are mandatory for understanding how to properly create an installer.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
GabrielBarbu
 
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am


Return to Common Problems

Who is online

Users browsing this forum: Bing [Bot], Daniel, Google [Bot] and 7 guests