Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Condition check using VBScript CA


5 replies to this topic

RickDavis790

RickDavis790
  • Full Members
  • 3 posts

Posted 19 July 2012 - 12:04

Hello -

I am trying to check if Internet Explorer is opened during my installation and block installation from proceeding further until IE is closed.
I have written a VBScript custom action to check if IE is opened and then display a message. I am calling this CA during on-click event of Install button in ReadytoInstall dialog. But after displaying the message, installation keeps progressing. How do I block the installer from proceeding further until IE is closed.
That is, clicking on Install should do nothing until IE is closed.

Thanks for your time,

RickDavis790

RickDavis790
  • Full Members
  • 3 posts

Posted 24 July 2012 - 12:03

Any help?

overlordchin

overlordchin
  • Full Members
  • 100 posts

Posted 24 July 2012 - 14:34

you have to set a property in your action to reference in the condition. Example:
CODE

function CheckServicesState(hMSI)
   string szServiceName, szMessage;
   number nServiceType;
begin
   szServiceName = "Explorer.exe";
   LoadStringFromStringTable("MyString", szMessage);
   ServiceGetServiceState(szServiceName, nServiceType);
   if (nServiceType = SERVICE_RUNNING)then
       MessageBox(szMessage, WARNING);
       MsiSetProperty(hMSI, "ServiceRunning", "1");  
   else
       MsiSetProperty(hMSI, "ServiceRunning", "0");
   endif;
end;


Then in your condition on the ReadyToInstall dialog
change your condition for end dialog to:

CODE
OutOfNoRbDiskSpace <> 1 AND ServiceRunning <> 1


This should prevent the dialog from progressing and allow them to close the app and click Install again. Hope this helps!


** its worth noting the detection code above probably wont actually find internet explorer. But the important tidbit is the MsiSetProperty bit which should still help you. **

Edited by overlordchin, 25 July 2012 - 16:21.


overlordchin

overlordchin
  • Full Members
  • 100 posts

Posted 26 July 2012 - 15:25

Also note my example was installscript. For VBscript i believe it is

CODE

Session.Property "MyProperty" = Value


or something along those lines

RickDavis790

RickDavis790
  • Full Members
  • 3 posts

Posted 06 August 2012 - 10:26

Thank you. It worked.
Actually I was trying with wrong condition. something like ServiceRunning = 1 instead of <>. Your suggestion helped me to try this.

overlordchin

overlordchin
  • Full Members
  • 100 posts

Posted 08 August 2012 - 13:47

Glad to hear you got it sorted out ^^