Solved

Install shield LaunchAppAndWait is not picking up my return codes from .vbs scripts

Posted on 2008-09-29
9
3,276 Views
Last Modified: 2013-11-14
I am running the attached Install shield function in Installshield professional 2008.

It is not picking up the return codes that I return from the .vbs script using the

      WScript.Quit(-5)

method.

Any idea what is wrong?
function NUMBER ProcessInstall(path, key, direction, drive, log)

	STRING szDirectory, szProgram, CommandOptions, szCmdLine, vbscriptPath;

	STRING sdirection, temp;

	NUMBER result;

begin     

	szDirectory = TARGETDIR;    //temp

	LongPathToQuote (szDirectory,TRUE);  

	LongPathToQuote (path,TRUE);   

	NumToStr ( sdirection, direction); 
 
 

	

	szProgram = "cscript.exe";

	CommandOptions =  " -Drive " + drive + " -key " + key + " -dir "  + sdirection;

	

	vbscriptPath =  TARGETDIR ^"\\ProcessInstall.vbs"  ;

	

	LongPathToQuote (vbscriptPath,TRUE);

	szCmdLine =vbscriptPath + CommandOptions + " -p " + path; 

	

	

	

	//MessageBox("Install command line:  " + szCmdLine ,WARNING);

	

	

	result = LaunchAppAndWait ( szProgram, szCmdLine, WAIT);

	return result;

	

end;

Open in new window

0
Comment
Question by:cschene
  • 4
  • 3
  • 2
9 Comments
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 300 total points
ID: 22596631
http://helpnet.acresso.com/robo/projects/DevStudio9HelpLangref/LangrefLaunchAppAndWait.htm
===============================
Return Values                                       
Return Value                   

Description                                             
0                   Indicates that the application was launched successfully.                                             
< 0                   Indicates that the application was not launched successfully.
===============================
It does not say anything about return code.

===============================
When running an MS-DOS program you cannot determine the return resultDOS_ERRORLEVEL. However, you can place an MS-DOS application in a batchfile and have the batch file recognize the error and then createanother file that contains the returned error code. You can then readthe file and determine the error code returned from the MS-DOSapplication.
===============================

that's what you probably have to do.
0
 

Author Comment

by:cschene
ID: 22596694
I wonder if I could place the response code in an environment variable anbd pick it up that way?
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 22596713
Sure, only it has to be machine-wide environment, not user.
0
 

Author Comment

by:cschene
ID: 22596896
Hi, If you can give me an example of reading  an error code and error text from a file, I will add 200 points.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 22598928
sorry, I'm not familiar with installsript.
0
 

Expert Comment

by:atash1
ID: 23656490
HI cschene,

How did u fix your installshield problem? how did u get LaunchAppAndWait.htmto return your vb results? can u please let me know. THANKS...
0
 

Author Comment

by:cschene
ID: 23666428
I used a file to communcate errors between installshield and the VB application.  I can upload the code if you wish.
0
 

Expert Comment

by:atash1
ID: 23666570
what I am trying to do is to save the query result to a file by doing :
launchappandwait ("sqlcmd.exe", " -S serverip - d database -E /Q "select version from versiontable" > vlog.txt" , ....)
... check the result and openfile ...

it returns zero but the file is not there .. not sure why. could u upload your code so I see what am I missing ?
0
 

Author Comment

by:cschene
ID: 23670144
What I believe happens is that you see a bad return (non zero) only if the command itself fails.  So, I was running msiexex.exe and even if the >msi install failed, the msiexec command itself  worked (it ran).

I will have to look around for the code
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now