lyledg Posted August 4, 2005 Posted August 4, 2005 Guys I am trying to write an automated installer for installing HP drivers for my company. HP do supply a install manager but it is flaky and does not work 50% of the time.. The drivers are downloaded in a SPxxxxx.exe. Within this *.exe when expanded is a *.cva file (Please see attached). This file is very similar to an *.ini as it has sections to read from, and has the silent install routine switches for each driver within. All the *.cva files have the same section, an example is shown below [Install Execution] SilentInstall="SP25656.exe" -s -a -silent -noreboot So, what I am trying to acheive is the following: 1) Open each *.cva file (The amount of these files will vary based on the amount of *.cva files available for each model of PC), and look for the code quoted above. 2) Strip out the SilentInstall= and the "" marks So that I am left with a complete line which reads as follows: SP25656.exe -s -a -silent -noreboot 3) And then be able to execute this command to that the driver installation is automated. Has anyone got any ideas on how to do this please? I was thinking of reading string as quoted above into an array, but not sure how I would do this for multiple strings. Am I on the right track or not...PLEASE help?? PS: I have renamed the attachment to an txt file as I was not able to attach it to this question as a *.cva file
GaryFrost Posted August 4, 2005 Posted August 4, 2005 looks like an ini file to me, just has diff ext on it, try ini read. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Josbe Posted August 4, 2005 Posted August 4, 2005 Check this code too. Just like gafrost said, IniRead it does: $sCVAFile = "SP25656.cva" $sCLine = IniRead( $sCVAFile, "Install Execution", "SilentInstall", '') $sArgs = StringSplit($sCLine, ' ') $sExeFile = $sArgs[1];<-- Exe (filename) For $i=1 To UBound( $sArgs ) - 1 MsgBox(0, "Argument #" & $i, $sArgs[ $i ]) Next AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
hgeras Posted August 4, 2005 Posted August 4, 2005 (edited) But Josbe forgot to trim the "" from the exe so you have to add some more code...And I added the whole process $sCVAFile = "SP25656.cva" $sCLine = IniRead( $sCVAFile, "Install Execution", "SilentInstall", ""') $sArgs = StringSplit($sCLine, ' ') $sExeFile = $sArgs[1];<-- Exe (filename) $sArgs[1]=StringTrimLeft($sArgs[1],1); To trim left " $sArgs[1]=StringTrimRight($sArgs[1],1); To trim right " $sCLine_stripped="" For $i=1 To UBound( $sArgs ) - 1 MsgBox(0, "Argument #" & $i, $sArgs[ $i ]) $sCLine_stripped&=$sArgs[$i] & " "; <--To make the $sArgs into one whole string again Next IniWrite($CVAFile, "Install Execution", "SilentInstall",$sCLine_stripped); <--To store the final string to the .cva again ....and you are done.... Edited August 4, 2005 by hgeras Useful information about COM/Objects referenceMy Scripts:PapDefragNvidia Temperature Logger V3.0 with graph analyzerAutoiIt Update Checker And Downloader V1.0ArrayPush UDF
lyledg Posted August 4, 2005 Author Posted August 4, 2005 Thanx Guys for being so very helpful!! CHEERS!!!
lyledg Posted August 5, 2005 Author Posted August 5, 2005 One last question, how would I loop through multiple *.cva files using the code you guys supplied to easily? Cheers
LxP Posted August 5, 2005 Posted August 5, 2005 $cvaList = fileFindFirstFile(@scriptDir & "\*.cva") if ($cvaList > -1) then while (1) $cva = fileFindNextFile($cvaList) if (@error) then exitLoop ; enter code to process this CVA file, ; name of which is found in $cva wEnd fileClose($cvaList) endIf
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now