Page 1 of 1 1
Topic Options
#159845 - 2006-03-27 04:53 PM Auto INF installer difficulties
danc303 Offline
Lurker

Registered: 2005-07-04
Posts: 1
Loc: UK
Hi there,
I am a beginner at kix, however I would like to get some help in correcting a
problem with an INF installer I am cobbling together. I have stolen some INF installer function code to install an INF from within the KIX script. The code from within the function code is currently untouched but i get an @error 2 presently. I curently beleive it is because the code wont work with a long path to the INF components on a network drive. i am stumped to whether I need to copy the INF components locally and "chdir" to them like in a batch file or whether I can work around problems with using a long path to a mapped drive. I currently beleive the batch file won't support the long network path location of the INF files, as it returns an "@error 2" from the function part of the code. Can anyone help with a more elegant solution ? Here is the code
Code:

GOSUB WINDIR
? Color b+/n "Lexis Checkout Component manual install"
use o: "\\ajgnt4\software"

If @INWIN = 2
EXIT
Endif
If @PRODUCTTYPE ="Windows 2000 Professional"
SHELL "%comspec% /c chdir /d O:\Utilities\Lexis\CheckoutCtrl_W2K\"
Endif
If @PRODUCTTYPE ="Windows XP Professional"
SHELL "%comspec% /c chdir /d O:\Utilities\Lexis\CheckoutCtrl_WXP\"
Endif


if FileAction("CheckoutCtrl.INF", "Install")
? "error occured:" @error
else
? "Install was Successful"
endif

If @INWIN = 1
$dllregisterPath=$WINDIR+"\system32\"
SHELL "%comspec% /c regsvr32 /s $dllregisterPath"
Endif

;use o: /DELETE /PERSISTENT:YES
sleep 5



:WINDIR ; 98 and NT
;Delimits LanRoot to get the windows directory path equiverlent to %WINDIR% in MSDOS
$lroot = @lanroot
$delimiter = "\"
$slen1 = len($lroot)
$stop1 = instr($lroot,$delimiter)
$part1 = substr($lroot,1,$stop1)
$lroot = substr($lroot,$stop1+1,$slen1-$stop1)
$slen2 = len($lroot)
$stop2 = instr($lroot,$delimiter)
$part2 = substr($lroot,1,$stop2)
$WINDIRTMP = ($part1 + $part2)
$WINDIR=LTRIM(SUBSTR($WINDIRTMP,1,(LEN($WINDIRTMP)-1)))
$ROOT = LTRIM(SUBSTR($Part1,1,(LEN($Part1)-2)))
$ProgramsDir=$ROOT+":\Progra~1"
If @INWIN = 1
$userprofile = "%userprofile%"
$SystemDir=$WINDIR+"\System32"
;$ProgramsDir=ReadValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\","ProgramFilesDir")

Endif
If @INWIN = 2
$SystemDir=$WINDIR+"\System"
;$ProgramsDir=ReadValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\","ProgramFilesPath")
Endif
RETURN


function FileAction($file,$action)
dim $shell,$
$fileaction=1
$shell=createobject("shell.application")
$file=$Shell.namespace($file).self
if @error $fileaction=2 exit 2 endif
for each $ in $file.verbs
if join(split($,"&"),"")=$action
$file.invokeverb(""+$)
$fileaction=0
endif
next
if $fileaction exit 1 endif
endfunction


Really I am just trying to do emulate this batch file below with a kix script that can check for OS type. IE different components for W2K and XP.

net use o: \\ajgnt4\software
chdir /d O:\Utilities\Lexis\CheckoutCtrl_WXP

rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 .\CheckoutCtrl.INF
regsvr32 CheckoutCtrl.ocx /s

net use o: /delete

Thankyou for any help you can give.

Bullock: added code tags


Edited by Howard Bullock (2006-03-27 10:05 PM)

Top
#159846 - 2006-03-27 11:15 PM Re: Auto INF installer difficulties
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Error 2 means file not found.
You need to give the fulle path to the CheckoutCtrl.INF file like so:

Code:

....
if FileAction("O:\Utilities\Lexis\CheckoutCtrl_W2K\CheckoutCtrl.INF", "Install")
....



or depending on Win2k or WinXP

Code:

....
if FileAction("O:\Utilities\Lexis\CheckoutCtrl_WXP\CheckoutCtrl.INF", "Install")
....




You could put almost the entire script inside and If-Else-Endif or Select-Case-Endselect statement instead of the gosub stuff. GoTo and GoSub make spaghetti code that is difficult to read and to follow the flow of the script. This is just a small script but guess what happens when it becomes bigger and bigger and bigger…….

System error codes on the MS site.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1376 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.052 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org