Script not running after files are installed to the system - Advanced Installer Community
gallyjh
Posts: 27
Joined: Tue Dec 20, 2011 5:01 pm

Script not running after files are installed to the system

I have a custom action that is a vbs script. In this script i use the Session Property to get the APPDIR variable, and it requires a file that is installed to be ran. Thus I need this script to run after the files have been placed on the system. I placed the script here:

Image

I even went as far showing the standard action 'InstallFiles' and 'StartServices' and tried adding it between there. But it still didn't work. I have a MsgBox in the script to give me a chance to investigate when it executes. When I get the MsgBox, I browse to the "C:\program files..." directory and nothing installed yet. WTF? This seems so straight forward yet it's not? What's going on here? Th execution time is set for 'Immediately', and I've tried other options but run into other issues.

Second question, after showing the extra standard actions 'InstallFiles', etc, why can't I hide them? Some times Advanced Installer can really drive you insane with these idiosyncrasies...
gallyjh
Posts: 27
Joined: Tue Dec 20, 2011 5:01 pm

Re: Script not running after files are installed to the syst

So I thought I'd add a timer to the script to make it check every second for 2 minutes to see if the file exists and then run the script:

Code: Select all

i = 0
Const MAX_ITER = 120
	Do Until i > MAX_ITER
	If fso.FileExists(scriptFile) Then
		'<RUNNING MY COMMAND>
		Exit Do
	Else
		i = i + 1
		
		REM Don't use wscript.sleep as Advanced Installer doesn't seem to like it.
		Dim dteWait
		dteWait = DateAdd("s", 1, Now())
		Do Until (Now() > dteWait)
		Loop
	End If
Loop
I unchecked 'Wait for custom action to finish before proceeding' and unchecked 'Wait for return code at the end of the sequence'. After running the installer, I can see that the installer is still waiting for the script to finish, as it took 2 minutes before finishing the installer. Once again what's up with it not working? This seems so straightforward... frustrating...
gallyjh
Posts: 27
Joined: Tue Dec 20, 2011 5:01 pm

Re: Script not running after files are installed to the syst

Going to try upgrading from 10.9.1 to the 11.4.1 in hopes that may be it fix my issue. Will report back.
gallyjh
Posts: 27
Joined: Tue Dec 20, 2011 5:01 pm

Re: Script not running after files are installed to the syst

Unfortunately, this still hasn't fixed the issue.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Script not running after files are installed to the syst

Hello,
I have a custom action that is a vbs script. In this script i use the Session Property to get the APPDIR variable, and it requires a file that is installed to be ran. Thus I need this script to run after the files have been placed on the system.
Since your custom action needs to launch a file which is part of the installation process, please make sure that you set the custom action Execution Time as When the system is being modified (deferred).

Please note that the deferred custom actions cannot have access the installer's public properties. However, you can pass information process through the CustomActionData property. Please take a look on the Pass installer properties in deferred custom action article which may be useful to you.

Please let us know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
gallyjh
Posts: 27
Joined: Tue Dec 20, 2011 5:01 pm

Re: Script not running after files are installed to the syst

Hi Dan,

Thanks for the feedback. I'll try that along with the CusomActionData, as I need the install path variable.

But don't you think that's counter-intuitive about what the options make you think they will do? If I have a custom action after the 'Add Resources' stage, as a user, I would automatically think that means the script would run after the resources are added to the system. I would also think that unchecking 'wait for custom action to finish before proceeding' would just run the script asynchronously however it doesn't. These options just don't make sense otherwise.

Thanks.
gallyjh
Posts: 27
Joined: Tue Dec 20, 2011 5:01 pm

Re: Script not running after files are installed to the syst

Hi Dan,

I went through the article you posted. It seems to show a c# example, do you have any sample project that would show how to do this with a VBS script file? Thanks.
gallyjh
Posts: 27
Joined: Tue Dec 20, 2011 5:01 pm

Re: Script not running after files are installed to the syst

Nevermind, I figured it out. I followed what this guy posted:

http://www.advancedinstaller.com/forums ... =2&t=12009

For future reference, basically 'Action Data:' is copied in as a string to the

Code: Select all

Session.Property("CustomActionData")

Return to “Common Problems”