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

LaunchAppAndWait - File Location to MSIEXEC


2 replies to this topic

sis_bakerm

sis_bakerm
  • Full Members
  • 2 posts

Posted 29 July 2009 - 15:37

Hi All,

I'm having some trouble with the LaunAppAndWait function, specifically how to pass a file location as a part of an msiexec command line parameter.

As part of my project, once all the required application files are copied onto the target machine, the installer also copies the setup files for a couple of support applciations and drivers into a separate directory under the TARGETDIR. I then call the LaunchAppAndWait function to run these setup files.

One of thesupport apps is ActiveSync 4.5, which is supplied as an MSI installer. I can get the Setup.exe files for the other support apps to execute without a problem, but when it come to the ActiveSync setup, I need to call msiexec to run the installation. As the setup.msi file is in a custom location I need to pass the file location as a command line parameter. My question is how to pass this file location as a command line parameter.

This is my script so far for all the LaunchAppAndWait functions.

function OnFirstUIAfter()
STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
NUMBER bvOpt1, bvOpt2;
NUMBER bShowUpdateServiceDlg;

BOOL bLaunch_ActiveSync_AndWait,
bLaunch_WAPUSB_AndWait,
bLaunch_BlueToothDrv_AndWait;

NUMBER nWait;
STRING szDirPath;

begin

// Installer will ask the user to specify which additional
// options they wish to install on the target PC.

Dlg_OtherApplications:

Disable (BACKBUTTON);
AskOptions (NONEXCLUSIVE, "Additional Options",
"Install Microsoft ActiveSync 4.5", bLaunch_ActiveSync_AndWait,
"Install WorkAbout Pro USB Drivers", bLaunch_WAPUSB_AndWait,
"Install Belkin BlueTooth Drivers", bLaunch_BlueToothDrv_AndWait
);

// Launch Microsoft ActiveSync Installer

if bLaunch_ActiveSync_AndWait then
if(LaunchAppAndWait
("msiexec.exe", "/i setup.msi",WAIT) < 0) then
MessageBox ("Unable to launch Setup.", SEVERE);
endif;
endif;

// Launch WorkAbout PRO USB Drivers Installer

if bLaunch_WAPUSB_AndWait then
if(LaunchAppAndWait
(TARGETDIR^"\\!Additional\\WAP USB Drivers\\usbsetup-wapro.exe","",WAIT) < 0) then
MessageBox ("Unable to launch Setup.", SEVERE);
endif;
endif;

// Launch Belkin USB BlueTooth Adaptor Drivers Installer

if bLaunch_BlueToothDrv_AndWait then
if(LaunchAppAndWait
(TARGETDIR^"\\!Additional\\Belkin BlueTooth Drivers\\setup.exe","",WAIT) < 0) then
MessageBox ("Unable to launch Setup.", SEVERE);
endif;
endif;

The full path to the ActiveSync installer is as follows:

TARGETDIR^\\!Additional\\ActiveSync\\ActiveSync 4.5\\setup.msi

I don't need the installer to run in quiet mode or anything like that, I literally just need to call it up.

Any help would be greatly appreciated!

Martin

Edited by sis_bakerm, 29 July 2009 - 15:37.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 29 July 2009 - 16:10

So you'd have to call something like:

LaunchAppAndWait
("msiexec.exe", "/i " + TARGETDIR^"!Additional\\ActiveSync\\ActiveSync 4.5\\setup.msi",WAIT)

or better using LongPathToQuote:

szPath = TARGETDIR^"!Additional\\ActiveSync\\ActiveSync 4.5\\setup.msi";
LongPathToQuote ( szPath, TRUE );
LaunchAppAndWait ( "msiexec.exe", "/i " szPath, WAIT );

sis_bakerm

sis_bakerm
  • Full Members
  • 2 posts

Posted 30 July 2009 - 10:19

Hi Stefan,

Thank you for your reply. After a little more digging I have managed to get the function to work correctly.

After a little more consultation, I decided to ammend the directory which the installer copied the setup.msi file into. I figured that the additional spaces in the file path weren't helping me much.

This is the script that finally worked for me:

// Launch Microsoft ActiveSync Installer

szPath = TARGETDIR^"\\!Additional\\ActiveSync\\setup.msi";
LongPathToQuote ( szPath, TRUE );

if bLaunch_ActiveSync_AndWait then
if(LaunchAppAndWait
("msiexec.exe", "/i " + szPath, WAIT) < 0) then
MessageBox ("Unable to launch Setup.", SEVERE);
endif;
endif;


Thanks again for your help.

Martin

Edited by sis_bakerm, 30 July 2009 - 10:20.