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

SRCDIR and LaunchAppandWait


5 replies to this topic

deepthght

deepthght
  • Members
  • 3 posts

Posted 07 October 2001 - 15:48

I have an InstallShield Script written in InstallShield Developer 7.0.

At one point in the script, I have some decision making going on.  Depending on the results of the decision, I may want to launch an application that will be resident on the CD.  If the condition is met where I want to launch the application, I call a function which contains the following code:

szCmdLine = "";
szProgram = SRCDIR ^ "\\setup\\Setup.exe";
         
nResult = LaunchAppAndWait ( szProgram , szCmdLine , WAIT );

I have tried everything I can think of, the program fails to execute every time.  I believe I have narrowed down the problem to the fact that the SRCDIR variable is for some reason not getting populated.

If I do:
   MessageBox (szProgram,SEVERE);

It displays "\setup1\setup.exe" but does not have the SRCDIR reference.  I have also tried using SRCDISK but encountered the same problem.

Does anybody have any ideas on how I can either solve this problem or use another method for what I am trying to do.  I am only sometimes launching
this application during the install process.  Is there an alternative way to capture the CD-ROM drive?

Thanks for the help!

Sincerely,
Matt Schwartz


Christof

Christof
  • Members
  • 56 posts

Posted 08 October 2001 - 09:20

Hi,
I tested it in my project and all worked fine. The only solution for this problem may be:
1.) Test your code at the beginning of your script, just before the dialogs. There it should work.
If there it also does not work you 'll have a big problem. In my opionion it must work.
2.) have a look if you use something like that in yopur code
VarSave(SRCTARGETDIR);
 SRCDIR = svSourcePath;
 TARGETDIR =  TARGETDIR ^ "CONFIG";
 nReturn  = XCopyFile ("TEST.INI", "MY.INI", COMP_NORMAL );
 VarRestore(SRCTARGETDIR);
If you forget the VarRestore then it is possible that InstallShield lost the SRCPATH.

Hope that helps
Greetings
Christof


deepthght

deepthght
  • Members
  • 3 posts

Posted 08 October 2001 - 13:54

Christof,

Thanks for your reply.  I appreciate it.  I did try putting the code in the beginning of the script.  What I do is set a variable (i.e. szSRCPATH=SRCDIR), then I debug the module and check the value of szSRCPATH when it hits that line.  The SRCDIR variable always returns a null string.  I have this code as the first line after the begin in my script.

I'm not using the VarSave command, so I shouldn't need to do a VarRestore - correct?

Thanks again for your help.

Matt


Christof

Christof
  • Members
  • 56 posts

Posted 09 October 2001 - 08:29

Hi,
sorry I can not reproduce this. I put it in the first line of my code and SRCDIR is not(!!) empty. This is one of the basics and this must work.
Do you use a standard script or a basis msi script ?
In msi scripts there may be deffirences to the standard scripts. I tested it with standard script and also created a new project - all worked ok.
Please try to create a new standard project and then insert the simple lines and tell me if there is still your problem.
If this does not work then save (backup) your scripts (projects) and try to reinstall IS7.
Hope this will help
Greetings
Christof
P.S. Sorry for my "german" english


obryanb

obryanb
  • Members
  • 1 posts

Posted 23 October 2001 - 13:08

I had the same problem for Installscript custom actions in the execute sequence. Try getting the properties explicitly with MsiGetProperty.

Your example would be..

nBuffer = 1024;
szCmdLine = "";

MsiGetProperty(hMSI, "SRCDIR", szSource, nBuffer);  

szProgram = szSource ^ "\\setup\\Setup.exe";
         
nResult = LaunchAppAndWait ( szProgram , szCmdLine , WAIT );



deepthght

deepthght
  • Members
  • 3 posts

Posted 24 October 2001 - 05:33

I tried using MsiGetProperty but that didn't work either.  Then I rebuilt the script from scratch, and it worked fine.  I'm not sure what happened - possibly some corruption in my project.  Same exact script worked fine when I rebuilt it.