This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- How to launch a PDF from InstallScript
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 27, 2007
04:34 PM
Launching PDF at end of Install--HELP!!!!
I am trying (desperately) to launch a Readme.PDF file at the end of the installation.
I have searched the help files and forums high and low (e.g. http://community.installshield.com/showthread.php?t=173666&highlight=pdf), tried every suggestion I could find, and am still failing miserably.
I have accomplished:
What I am trying to accomplish is launch whatever the user's PDF reader is with my README.pdf as the argument.
I have tried:
LaunchApp
LaunchAppAndWait
LongPathToQuote
LongPathToShortPath
Moving AcroRd32.exe to the C:\ directory
What I *believe* may be the problem is that the path has spaces in it (e.g. c:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe), as I am also unable to run this from the DOS command line.
Here is a script snippet (I can post the whole thing, if that would help):
Any thoughts as to what I am doing wrong?
Although the licensed copy of InstallShield is version 12 that this will be built on, I am playing with this using a evaluation version of 2008 on my home PC (I have not been able to get it to work on either).
Thanks.
* ijhutch *
I have searched the help files and forums high and low (e.g. http://community.installshield.com/showthread.php?t=173666&highlight=pdf), tried every suggestion I could find, and am still failing miserably.
I have accomplished:
- Reading the registry to find the path to the application AcroRd32.exe
- Displaying the path in a message box
What I am trying to accomplish is launch whatever the user's PDF reader is with my README.pdf as the argument.
I have tried:
LaunchApp
LaunchAppAndWait
LongPathToQuote
LongPathToShortPath
Moving AcroRd32.exe to the C:\ directory
What I *believe* may be the problem is that the path has spaces in it (e.g. c:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe), as I am also unable to run this from the DOS command line.
Here is a script snippet (I can post the whole thing, if that would help):
#define READMEFILE TARGETDIR ^ "1_README_PackageOverview.pdf"
#include "Ifx.h"
function OnFirstUIAfter()
STRING szProductName, szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
//NUMBER bvOpt1, bvOpt2;
BOOL bvOpt1, bvOpt2;
NUMBER bShowUpdateServiceDlg;
NUMBER nReturn;
NUMBER nvFileHandle;
STRING szKey, szNumName, szNumValue, svNumValue, szTitle2, szMsg;
NUMBER nType, nSize, nvType, nvSize;
begin
// Set the product name to substitute for the %P place holder.
szProductName = "ReqSuite2 Demo";
SdProductName (szProductName);
// Setup parameters that will be passed to SdFinish.
szTitle = "Choices...";
szMsg1 = "%P Setup is almost complete.\n" + "Choose the options you want below.";
szMsg2 = "Click Finish to complete %P Setup.";
szOpt1 = "I would like to view the README (PDF) file.";
szOpt2 = "I would like to launch %P.";
SdFinish (szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2);
if (bvOpt1) then
// Display the read me file.
//LaunchAppAndWait (ADOBEREADER, READMEFILE, WAIT);
// #include "Ifx.h"
// export prototype ExFn_OpenFileMode(HWND);
// Set the file mode to normal.
// always set root key before calling other RegDB functions
RegDBSetDefaultRoot(HKEY_CLASSES_ROOT);
if (RegDBKeyExist("acrobat\\DefaultIcon") = 1) then
MessageBox("ThisApp is on the system.", INFORMATION);
endif;
// Retrieve key value information.
szKey = "acrobat\\DefaultIcon";
if (RegDBGetKeyValueEx (szKey, szNumName, nvType, svNumValue, nvSize) < 0) then
MessageBox ("RegDBGetKeyValueEx failed.", SEVERE);
else
// Display what RegDBGetKeyValueEx retrieved.
szMsg = "%s has value: %s\n\nThis data is %d bytes.";
SprintfBox (INFORMATION, TITLE, szMsg, szNumName, svNumValue, nvSize);
endif;
//LongPathToQuote(svNumValue, TRUE);
if (LongPathToShortPath (svNumValue) < 0) then;
MessageBox ("LongPathToShortPath failed.", SEVERE);
abort;
else
// Display the short path.
szMsg = "The short path is shown below: \n\n%s";
SprintfBox (INFORMATION, TITLE, szMsg, svNumValue);
endif;
MessageBox ("Opening with C: path next, no doc", SEVERE);
LaunchApp("C:\\" ^ "AcroRd32.exe", "");
MessageBox ("Opening with C: path next with READMEFILE = " + READMEFILE, SEVERE);
LaunchApp("C:\\" ^ "AcroRd32.exe", READMEFILE);
MessageBox ("opening " + READMEFILE + "with svNumValue after LongPathToQuote at end next. svNumValue =" + svNumValue, SEVERE);
LaunchApp(svNumValue ^ "AcroRd32.exe", READMEFILE);
MessageBox ("opening " + READMEFILE + "without \ at end next.", SEVERE);
LaunchApp("C:\\Program Files\\Adobe\\Reader 8.0\\Acrobat" ^ "AcroRd32.exe", READMEFILE);
OpenFileMode (FILE_MODE_NORMAL);
if (OpenFile (nvFileHandle, TARGETDIR, READMEFILE) < 0) then
MessageBox ("OpenFile failed.", SEVERE);
abort;
endif;
OpenFileMode (FILE_MODE_BINARY);
// Open the file.
if (OpenFile (nvFileHandle, TARGETDIR, READMEFILE) < 0) then
MessageBox ("OpenFile failed.", SEVERE);
abort;
endif;
endif;
end;
Any thoughts as to what I am doing wrong?
Although the licensed copy of InstallShield is version 12 that this will be built on, I am playing with this using a evaluation version of 2008 on my home PC (I have not been able to get it to work on either).
Thanks.
* ijhutch *
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 27, 2007
06:51 PM
There are a number of ways to do it:
The easiest is to create a custom action that launches an application "cmd.exe"
* first: check and see if the user have adobe reader installed .. as a precondition
* second: create a custom action as follows:
-Choose Custom Action Wizard
-for Name: OpenPDF
-Type: Launch an executable
-Location: Stored in Directory table
-Source: stored in system16Folder
-Target: cmd.exe /c "[INSTALLDIR]MyREADME.pdf"
-Return Processing: Asynchronous (No wait for completion)
-In-script Execution: Immediate Execution
You could change the dialog "SetupCompleteSuccess" and add a check box to open the pdf and attach an event to the finish button to call the custom action if the checkbox is checked.
Although there will be a command prompt that opens up in the background as long as the pdf file is open.
The easiest is to create a custom action that launches an application "cmd.exe"
* first: check and see if the user have adobe reader installed .. as a precondition
* second: create a custom action as follows:
-Choose Custom Action Wizard
-for Name:
-Type: Launch an executable
-Location: Stored in Directory table
-Source: stored in system16Folder
-Target: cmd.exe /c "[INSTALLDIR]MyREADME.pdf"
-Return Processing: Asynchronous (No wait for completion)
-In-script Execution: Immediate Execution
You could change the dialog "SetupCompleteSuccess" and add a check box to open the pdf and attach an event to the finish button to call the custom action if the checkbox is checked.
Although there will be a command prompt that opens up in the background as long as the pdf file is open.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 27, 2007
11:25 PM
Hmmmm. So you are saying re-do the Project and do NOT make it an InstallScript (because that is what I have now).
It seems with the InstallScript option, this Custom Action thing is unavailable.
(I don't really want to start over, though...everything else is working ok...but I will if no one else can offer help).
Thanks for the reply.
* ijhutch *
It seems with the InstallScript option, this Custom Action thing is unavailable.
(I don't really want to start over, though...everything else is working ok...but I will if no one else can offer help).
Thanks for the reply.
* ijhutch *
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 28, 2007
07:23 AM
OK, quick update.
I got it pretty much working and tested on XP Pro.
First, the registry key which was supposed to return the path based on the "default icon" was WRONG (it was a subtle difference). I had to use the "acrobat\\shell\\open\\command" key, then strip off all the gook at the end of it using the Path, Length, and StrSub commands.
Second, I had to make good use of the LongPathToShortPath function so that the LaunchApp command would work correctly with both the path to the executable as well as the path to the target PDF (TARGETDIR).
Next will be to test the setup on non XP Pro machines.
Anyone know how to make the SdFinish dialog box have the checkboxes be true by default? I tried setting the value in User Interface-->Dialogs, but I got the warning "ISDEV : warning Found duplicate Control Identifier:501, in Control:. A new (unique) Control Identifier was generated." and it didn't work.
* ijhutch *
I got it pretty much working and tested on XP Pro.
First, the registry key which was supposed to return the path based on the "default icon" was WRONG (it was a subtle difference). I had to use the "acrobat\\shell\\open\\command" key, then strip off all the gook at the end of it using the Path, Length, and StrSub commands.
Second, I had to make good use of the LongPathToShortPath function so that the LaunchApp command would work correctly with both the path to the executable as well as the path to the target PDF (TARGETDIR).
Next will be to test the setup on non XP Pro machines.
Anyone know how to make the SdFinish dialog box have the checkboxes be true by default? I tried setting the value in User Interface-->Dialogs, but I got the warning "ISDEV : warning Found duplicate Control Identifier:501, in Control:. A new (unique) Control Identifier was generated." and it didn't work.
* ijhutch *
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 29, 2007
12:38 PM
You can activate the one/two default options in SdFinish() by setting bOpt1 = true and/or bOpt2 = true under function OnFirstUIAfter().
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 12, 2007
11:41 AM
Thomas Nguyen wrote:
There are a number of ways to do it:
The easiest is to create a custom action that launches an application "cmd.exe"
* first: check and see if the user have adobe reader installed .. as a precondition
* second: create a custom action as follows:
-Choose Custom Action Wizard
-for Name:OpenPDF
-Type: Launch an executable
-Location: Stored in Directory table
-Source: stored in system16Folder
-Target: cmd.exe /c "[INSTALLDIR]MyREADME.pdf"
-Return Processing: Asynchronous (No wait for completion)
-In-script Execution: Immediate Execution
You could change the dialog "SetupCompleteSuccess" and add a check box to open the pdf and attach an event to the finish button to call the custom action if the checkbox is checked.
Although there will be a command prompt that opens up in the background as long as the pdf file is open.
I've been looking for a way to launch a HTA file everywhere, and tried your way, and it works!!! 😄 😄
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 04, 2009
12:30 PM
You can launch any file from your InstallScript by doing the following:
szProgram = TARGETDIR ^ ".pdf";
LongPathToQuote( szProgram, TRUE );
szDirectory = "";
szCmdLine = "";
LAAW_SHELLEXECUTEVERB = "open";
LaunchApplication( szProgram, szCmdLine, szDirectory, SW_SHOWNORMAL, 0, LAAW_OPTION_USE_SHELLEXECUTE );
Please make sure you are using the "\\" for.
This assumes that user has some kind of PDF reader installed on their system.
szProgram = TARGETDIR ^ "
LongPathToQuote( szProgram, TRUE );
szDirectory = "";
szCmdLine = "";
LAAW_SHELLEXECUTEVERB = "open";
LaunchApplication( szProgram, szCmdLine, szDirectory, SW_SHOWNORMAL, 0, LAAW_OPTION_USE_SHELLEXECUTE );
Please make sure you are using the "\\" for
This assumes that user has some kind of PDF reader installed on their system.