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

Custom Action to run an application


5 replies to this topic

BRY

BRY
  • Members
  • 44 posts

Posted 29 April 2002 - 15:44

Hi folks,

I am seeing something wierd:

I have created a custom action to update the installation copy of the "PATH" environment variable at runtime, and then launch the "regsvr32" application to register a file.

The line in my script to run the app is:
LaunchAppAndWait("regsvr32", INSTALLDIR ^ "Shared\\Com\\Agl.dll", WAIT);

However, whenever my installation tries to run this custom action, I get an error from the regsvr32 applicationm saying that it can't find the file
Shared\Com\Agl.dll

I have debugged, and found that the value of INSTALLDIR is "" (blank), when I have already gone through the dialog sequence and chosen it's value.

Can anyone help?
Is there any typos?

I have inserted my custom action in the Installation\Execute sequence, directly after the WriteRegistryValues action.

Would the placement cause any problems?

Thanks for any help...
Bryan Dickson
[br]Senior Software Engineer
[br]Fugro-UDI Limited

Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 30 April 2002 - 00:20

If you're running your custom action as deferred, then you should probably have a look at http://support.insta...m/kb....Q104413

I'm also assuming that your call to MsiGetProperty is done correctly.


Leigh Ravenhall
Expert Information Services

BRY

BRY
  • Members
  • 44 posts

Posted 30 April 2002 - 12:03

Thanks for that.
I've found out that my call to MsiGetProperty wasn't correct, but I have now fixed it.
However, I now have another problem in my same function.
I have the following code:

STRING szInstallFolder
NUMBER nvSize

nvSize = 256;
MsiGetProperty(hMSI, "INSTALLDIR", szInstallFolder, nvSize);

// Test only - display the value.
MessageBox(szInstallFolder, INFORMATION);

LaunchAppAndWait("regsvr32", szInstallFolder ^ "Shared\\COM\\Agl.dll", WAIT);


When the test message box is displayed, the correct install path is shown.
However, when it tries to run the "regsvr32" application, I get an error saying it can't find the file "C:\Program"

My guess is that it's not getting past the space " " in the install path.

How can I get it to recognise that there is more to the path?
Bryan Dickson
[br]Senior Software Engineer
[br]Fugro-UDI Limited

BRY

BRY
  • Members
  • 44 posts

Posted 30 April 2002 - 12:05

Thanks for that.
I've found out that my call to MsiGetProperty wasn't correct, but I have now fixed it.
However, I now have another problem in my same function.
I have the following code:

STRING szInstallFolder
NUMBER nvSize

nvSize = 256;
MsiGetProperty(hMSI, "INSTALLDIR", szInstallFolder, nvSize);

// Test only - display the value.
MessageBox(szInstallFolder, INFORMATION);

LaunchAppAndWait("regsvr32", szInstallFolder ^ "Shared\\COM\\Agl.dll", WAIT);


When the test message box is displayed, the correct install path is shown.
However, when it tries to run the "regsvr32" application, I get an error saying it can't find the file "C:\Program"
(The correct install path is C:\Program Files\Company\Product)

My guess is that it's not getting past the space " " in the install path.

How can I get it to recognise that there is more to the path?
Bryan Dickson
[br]Senior Software Engineer
[br]Fugro-UDI Limited

BRY

BRY
  • Members
  • 44 posts

Posted 30 April 2002 - 12:06

Oops!

Sorry, didn't mean to post that last message twice - must have pressed the button by mistake...
Bryan Dickson
[br]Senior Software Engineer
[br]Fugro-UDI Limited

Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 01 May 2002 - 02:02

Your guess is correct, regsvr32 doesn't cope with spaces in a path name, unless it is within quotes.

To work around this, you can try the following:

szFile = szInstallFolder ^ "Shared\\COM\\Agl.dll";

LongPathToShortPath(szFile);

This returns the short filename, something like c:\progra~1\......

Another option is to call LongPathToQuote(szFile, TRUE) in place of the LongPathToShortPath.

Regardless of which option you choose, if your LaunchAppAndWait then calls szFile, it should find it.

One other thing, if you would like to get rid of the DOS box, grab the LaunchAppEx script from IS5/6 Samples.  It will also catch the return value from regsvr32 to see if anything has gone wrong.
Leigh Ravenhall
Expert Information Services