#31867 - 2002-11-06 11:05 AM
Using kix to run exe with conditions
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Hi, could anybody help me with what I am doing. currently im trying to get a packaged prog. to run using DOS batch (not working) that checks for an exe and if its not their will run installion, if it is their it will ignore and just run prog. Can this be achieved in kix? this is my dos ver.
code:
IF NOT EXIST C:\PROGRA~1\ADOBE\ACROBA~1.0\Reader\AcroRd32.exe GOTO INSTALL :INSTALL P:\ADOBE\ADOBE.EXE :END C:\PROGRA~1\ADOBE\ACROBA~1.0\Reader\AcroRd32.exe
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
#31868 - 2002-11-06 11:59 AM
Re: Using kix to run exe with conditions
|
Mit
Fresh Scripter
Registered: 2002-06-05
Posts: 36
Loc: Derby, UK
|
use else/if [ 06. November 2002, 12:00: Message edited by: Mit ]
|
|
Top
|
|
|
|
#31869 - 2002-11-07 12:34 AM
Re: Using kix to run exe with conditions
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Tried the following but to no avail. code:
IF EXIST ("C:\PROGRA~1\ADOBE\ACROBA~1.0\Reader\AcroRd32.exe" =0) RUN P:\ADOBE\ADOBE.EXE ELSE RUN C:\PROGRA~1\ADOBE\ACROBA~1.0\Reader\AcroRd32.exe EXIT
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
#31870 - 2002-11-07 12:43 AM
Re: Using kix to run exe with conditions
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Stephen, reading the manual to get the proper commands and syntax would help you greatly.
code:
IF NOT EXIST ("C:\PROGRA~1\ADOBE\ACROBA~1.0\Reader\AcroRd32.exe") RUN "P:\ADOBE\ADOBE.EXE" ELSE RUN "C:\PROGRA~1\ADOBE\ACROBA~1.0\Reader\AcroRd32.exe" Endif
or code:
IF EXIST ("C:\PROGRA~1\ADOBE\ACROBA~1.0\Reader\AcroRd32.exe") = 0 RUN "P:\ADOBE\ADOBE.EXE" ELSE RUN "C:\PROGRA~1\ADOBE\ACROBA~1.0\Reader\AcroRd32.exe" Endif
|
|
Top
|
|
|
|
#31872 - 2002-11-06 03:36 PM
Re: Using kix to run exe with conditions
|
Sealeopard
KiX Master
   
Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
|
Don't use the 8.3 notiation for filenames, rather put the complete path/filename in quotes.
Below is the Acrobat/Acrobat Reader install routine that is part of KSMS. It checks for the presence of Acrobat/Acrobat Reader and updates/installes the programs if necessary.
However, it does require some preparation. 1) I recorded a silent install for each program using the -r silent install option which creates a.ISS file (see also installer/application documentation for silent installs) 2) The install routine runs under administrative privileges under Windows NT/2000/XP 3) It uninstalls Acrobat 4.0 is present 4) Contains some error checking routines (disk space, file replacement on reboot) that could result in failed installation
code:
;------------------------------------- ; subroutine to install Adobe Acrobat 5.0 or Adobe Acrobat Reader 5.0 ;------------------------------------- :ACROBAT Dim $retcode, $readerkey, $readervalue, $readerexe, $readerversion, $shellcommand, $readeruninstall Dim $acrobatpresent, $acrobatdir, $acrobatcomps
if diskspace()<100000 gosub CHECKHDSPACE return endif
$acrobatpresent=0
; check whether Adobe Acrobat Reader is installed $readerkey=$HKLM+'\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRD32.exe' $readervalue='' if keyexist($readerkey) $readerexe=readvalue($readerkey,$readervalue) if exist($readerexe) $acrobatpresent=1 $readerversion=getfileversion($readerexe,'ProductVersion') $retcode=displaytext('Found Adobe Acrobat Reader '+$readerversion) if compareversions($readerversion,'5.0.5.0')<0 $retcode=displaytext('Preparing uninstalling of Adobe Acrobat Reader '+$readerversion) $readerkey=$HKLM+'\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 4.0' $readervalue='UninstallString' if keyexist($readerkey) $readeruninstall=READVALUE($readerkey,$readervalue) $retcode=displaytext('Uninstalling Adobe Acrobat Reader '+$readerversion) $shellcommand=$readeruninstall+' -A' $retcode=shellcmd($shellcommand,1) endif
if checkupdateonreboot()<>0 $retcode=displaytext('Aborting installation of Adobe Acrobat Reader due to scheduled file replacements on reboot') else if getdiskspace('%WINDIR%')>30000 $retcode=displaytext('Installing Adobe Acrobat Reader 5.0.5') $shellcommand=fullfile($DEPLOYDIR,'acroread5\setup.exe -SMS -z') $retcode=shellcmd($shellcommand,1) $REBOOTREQUIRED=1 else $retcode=sendmessage(@WKSTA,'Diskspace is getting low. Please clean up!') endif endif else $retcode=displaytext('Latest version of Adobe Acrobat Reader is installed') endif else $retcode=warning('Cannot find file '+$readerexe) $acrobatpresent=0 endif else $retcode=displaytext('Adobe Acrobat Reader is not installed') $acrobatpresent=0 endif
; check whether Adobe Acrobat is installed $readerkey=$HKLM+'\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe' $readervalue='' if keyexist($readerkey) $readerexe=readvalue($readerkey,$readervalue) if exist($readerexe) $acrobatpresent=1 $readerversion=getfileversion($readerexe,'ProductVersion') $retcode=displaytext('Found Adobe Acrobat '+$readerversion) select case compareversions($readerversion,'5.0.0.0')<0 ; install Adobe Acrobat 5.0.0.0 $retcode=displaytext('Preparing uninstalling of Adobe Acrobat '+$readerversion) $readerkey=$HKLM+'\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 4.0' $readervalue='UninstallString' if keyexist($readerkey) $readeruninstall=READVALUE($readerkey,$readervalue) $retcode=displaytext('Uninstalling Adobe Acrobat '+$readerversion) $shellcommand=$readeruninstall+' -A' $retcode=shellcmd($shellcommand,1)
if checkupdateonreboot()<>0 $retcode=displaytext('Aborting installation of Adobe Acrobat due to scheduled file replacements on reboot') else if getdiskspace('%WINDIR%')>120000 $retcode=displaytext('Installing Adobe Acrobat 5.0') $shellcommand=fullfile($DEPLOYDIR,'acrobat5\setup.exe -SMS -z') $retcode=shellcmd($shellcommand,1) $REBOOTREQUIRED=1 else $retcode=sendmessage(@WKSTA,'Diskspace is getting low. Please clean up!') endif endif endif case compareversions($readerversion,'5.0.5.0')<0 ; update Adobe Acrobat 5.x to 5.0.5 if checkupdateonreboot()<>0 $retcode=displaytext('Aborting upgrade of Adobe Acrobat due to scheduled file replacements on reboot') else if getdiskspace('%WINDIR%')>120000 $retcode=displaytext('Updating Adobe Acrobat to version 5.0.5') $shellcommand=fullfile($DEPLOYDIR,'acrobat505update\setup.exe -s -SMS -z') $retcode=shellcmd($shellcommand,1) $REBOOTREQUIRED=1 else $retcode=sendmessage(@WKSTA,'Diskspace is getting low. Please clean up!') endif endif case 1 $retcode=displaytext('Latest version of Acrobat is installed') endselect else $retcode=warning('Cannot find file '+$readerexe) endif else $retcode=displaytext('Adobe Acrobat is not installed') $acrobatcomps=readprofilestring($SCRIPTINI,'Software','AdobeAcrobat') $acrobatcomps=atrim(split($acrobatcomps,',')) if isinarray(@WKSTA,$acrobatcomps) $retcode=displaytext('Adobe Acrobat 5.0 is required for this computer') if checkupdateonreboot()<>0 $retcode=displaytext('Aborting installation of Adobe Acrobat due to scheduled file replacements on reboot') else if getdiskspace('%WINDIR%')>120000 $retcode=displaytext('Installing Adobe Acrobat 5.0') $shellcommand=fullfile($DEPLOYDIR,'acrobat5\setup.exe -SMS -z') $retcode=shellcmd($shellcommand,1) $REBOOTREQUIRED=1 else $retcode=sendmessage(@WKSTA,'Diskspace is getting low. Please clean up!') endif endif endif endif
; install Adobe Acrobat Reader 5.0.5 if no Acrobat product present at all if $acrobatpresent=0 $retcode=warning('No Adobe Acrobat product found. Installing Adobe Acrobat Reader 5.0.5') $shellcommand=fullfile($SCRIPTDIRECTORY,'deploy\acroread5\setup.exe -SMS -z')
if checkupdateonreboot()<>0 $retcode=displaytext('Aborting installation of Adobe Acrobat Reader due to scheduled file replacements on reboot') else if getdiskspace('%WINDIR%')>30000 $retcode=shellcmd($shellcommand,1) $REBOOTREQUIRED=1 else $retcode=sendmessage(@WKSTA,'Diskspace is getting low. Please clean up!') endif endif endif
; move the Adobe Acrobat Reader link to correct location $acrobatexe=fullfile($COMMONPROGRAMS,'Acrobat Reader 5.0.lnk') $acrobatdir=fullfile($COMMONPROGRAMS,'\Adobe\') if exist($acrobatexe) if $VERBOSE $retcode=displaytext('Moving Adobe link '+$acrobatexe+' to '+$acrobatdir) endif if not exist($acrobatdir) if $VERBOSE $retcode=displaytext('Creating directory '+$acrobatdir) endif md $acrobatdir endif copy $acrobatexe $acrobatdir del $acrobatexe endif
; move the Adobe Acrobat link to correct location $acrobatexe=fullfile($COMMONPROGRAMS,'Adobe Acrobat 5.0.lnk') $acrobatdir=fullfile($COMMONPROGRAMS,'Adobe\') if exist($acrobatexe) if $VERBOSE $retcode=displaytext('Moving Adobe link '+$acrobatexe+' to '+$acrobatdir) endif if not exist($acrobatdir) if $VERBOSE $retcode=displaytext('Creating directory '+$acrobatdir) endif md $acrobatdir endif copy $acrobatexe $acrobatdir del $acrobatexe endif
; move the Adobe Distiller link to correct location $acrobatexe=fullfile($COMMONPROGRAMS,'Acrobat Distiller 5.0.lnk') $acrobatdir=fullfile($COMMONPROGRAMS,'Adobe\') if exist($acrobatexe) if $VERBOSE $retcode=displaytext('Moving Adobe link '+$acrobatexe+' to '+$acrobatdir) endif if not exist($acrobatdir) if $VERBOSE $retcode=displaytext('Creating directory '+$acrobatdir) endif md $acrobatdir endif copy $acrobatexe $acrobatdir del $acrobatexe endif
return
[ 06. November 2002, 15:40: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.
|
|
Top
|
|
|
|
#31873 - 2002-11-06 03:41 PM
Re: Using kix to run exe with conditions
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
btw...
no need to make a iss file for adobe products.
you merely need to edit the Abcpy.ini file
|
|
Top
|
|
|
|
#31874 - 2002-11-08 02:23 PM
Re: Using kix to run exe with conditions
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Thanks for everyones help with this, if checking for files rather than a key is bad practice why is this? I assume because software can be installed into dif. locations? Also, once my app is installed is their a simple way I can force it to run else my pupils are having to run the icon again...
Thanks again
Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
#31876 - 2002-11-08 02:42 PM
Re: Using kix to run exe with conditions
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
That's fine... I was just being specific
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(StuTheCoder)
and 798 anonymous users online.
|
|
|