Without the benefit of having the program you're trying to install, it's tough. Sounds like you need to test for OS and write separate code for each. Also for NT/2K need to check for permissions. Here's a sample:
code:
; check OS WinNT = 1, Win95 = 2
;
if @INWIN = 2 goto OSRightsOK endif
;-----------------------------------------------------------------------------------
;must not be Win95, therefor must be WinNT so more checks are in order
;-----------------------------------------------------------------------------------
; check if logon to Server or Workstation
;PRODUCTTYPE - WinNT = Workstation, ServerNT = Member Server, LanmanNT = Domain Controller
;
$PRODUCTTYPE = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\PRODUCTOPTIONS","PRODUCTTYPE")
if $PRODUCTTYPE = "WinNT" goto NTwks endif
;
; if logon to server as non-admin, just exit without notice (for WTS users) else nag and exit
;
if INGROUP ("Domain Admins") <> 2 goto finish
beep
$RC = MessageBox("NOTICE!" + Chr(13) + "YOU ARE LOGGED ON TO A SERVER, installation aborting!"
+ Chr(13),"ShowCase Strategy 3 Install",16,60)
goto finish
ENDIF
;-----------------------------------------------------------------------------------
:NTwks
;-----------------------------------------------------------------------------------
; check if NT User has Local Admin rights
;
if INGROUP ("\\" + @WKSTA + "\Administrators") = 2
goto OSRightsOK
else
beep
$RC = MessageBox("NOTICE!" + Chr(13) + "Insufficient rights, installation aborting!"
+ Chr(13) + "Please notify the FF HelpDesk at ext. 1864","ShowCase Strategy 3 PTF O301120 Install",16,60)
goto finish
endif
;-----------------------------------------------------------------------------------
:OSRightsOK
As far as the 14070 I suspect 1407 is error and/or result codes. To suppress the result code you can put a $RC (or $anything) in front of the function like this:
$RC = setfocus (bla-bla-bla)The stuff between the quotes on setfocus() has to match each window exactly. Close doesn't count. It would also be good practice to use FlushKB to clear the buffer in case your users hit keys before your SendKeys().
Also, with SHELL, the script should wait. If it does, there's nothing to setfocus to. You may need to use RUN instead.
That's the problem with using a file flag to test if installed. If your codes not rock solid, you could have a failed install and a set flag. If the install adds itself to add/remove, I prefer the registry check.
If you're doing an upgrade, another thing you can do is to test the current version to determine if an upgrade is needed. Here's how I do that:
code:
if GetFileVersion($syspath + "\SCODBC32.DLL") = "3.01.120.122 (2001-05-10)"
goto finish
endif