#155948 - 2006-01-25 07:39 PM
How do I...
|
dataspike
Getting the hang of it
Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
|
OK, here's what I'd like to be able to accomplish. Currently I have a function (below) that will allow me to update an application based on variables I call from the function. But I would like to be able to store the entries in a text file and have the function read the text file instead. That way the end user can update the file I don't have to create a new function call for each updated application. I have provided a sample of the text file format I would like to use. I hope I've explained it well enough.
Thanks!
Code:
Function AppUpdate($DisplayName,$originalfilename,$originalpath,$updatefilename,$updatepath)
$NetApp = $updatepath + "\" + $updatefilename $LocalApp = $originalpath + "\" + $originalfilename If Exist($LocalApp) ; $lblStatus.Text = "Checking for " + $DisplayName + "..." $NetVer = GetFileVersion($updatefilename,"FileVersion") ; $lblStatus.Text = "Checking " + $DisplayName + "Version..." $LocalVer = GetFileVersion($originalfilename,"FileVersion") If $LocalVer <> $NetVer ; $lblStatus.Text = "Updating " + $DisplayName + ", please be patient..." Copy $NetApp $LocalApp /h /r /c ; LogInfo("\\server1\itdept\mfg\install logs\" + $DisplayName + ".csv","@DATE,@TIME,@WKSTA,@USERID,$CurrentIP,Old Version: $LocalVer,New Version: $NetVer") ; $lblStatus.Text = "MFG Applications Updated..." Sleep 0.5 EndIf EndIf
EndFunction
AppUpdate("Test Application Update","TestApp.exe","%programfiles%\testapp","TestApp.exe","\\server1\updatedexes")
Here's the FloorUpdate.ini file
Quote:
Test Application Update,testapp.exe,%programfiles%\testapp,testapp.exe,\\server1\updatedexes Notepad,notepad.exe,%windir%,notepad.exe,\\server2\testapp\new2
Edited by dataspike (2006-01-25 07:41 PM)
|
|
Top
|
|
|
|
#155952 - 2006-01-25 08:03 PM
Re: How do I...
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
ja, thats the beauty of it, here is the code, assumption is you have a file called install.ini in the current dir formatted as above:
Code:
Break On
$PROFILE = ".\install.ini"
For Each $AppSection In Split(ReadProfileString($PROFILE, "", ""), CHR(10))
If $AppSection
?"App=" $AppSection
Endif
Next
Exit 0
|
|
Top
|
|
|
|
#155953 - 2006-01-25 08:05 PM
Re: How do I...
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
and of course taking it to the next level ...
Code:
Break On
$PROFILE = ".\install.ini"
For Each $AppSection In Split(ReadProfileString($PROFILE, "", ""), CHR(10))
If $AppSection
$DisplayName = ReadProfileString($PROFILE, $AppSection, "DisplayName") $OriginalFilename = ReadProfileString($PROFILE, $AppSection, "OriginalFileName")
? ?"DisplayName = " $DisplayName ?"OriginalFileName = " $OriginalFileName
Endif
Next
Exit 0
|
|
Top
|
|
|
|
#155954 - 2006-01-25 08:13 PM
Re: How do I...
|
dataspike
Getting the hang of it
Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
|
Quote:
and of course taking it to the next level ...
Code:
Break On
$PROFILE = ".\install.ini"
For Each $AppSection In Split(ReadProfileString($PROFILE, "", ""), CHR(10))
If $AppSection
$DisplayName = ReadProfileString($PROFILE, $AppSection, "DisplayName") $OriginalFilename = ReadProfileString($PROFILE, $AppSection, "OriginalFileName")
? ?"DisplayName = " $DisplayName ?"OriginalFileName = " $OriginalFileName
Endif
Next
Exit 0
You 
Thanks!
|
|
Top
|
|
|
|
#155955 - 2006-01-25 09:21 PM
Re: How do I...
|
dataspike
Getting the hang of it
Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
|
Finished Product...
Thanks Shawn.
Code:
Function Floor_App_Updates $iniFile = @SCRIPTDIR + "\floorupdate.ini"
For Each $AppSection in Split(ReadProfileString($iniFile, "", ""), Chr(10)) If $AppSection $DisplayName = ReadProfileString($iniFile, $AppSection, "DisplayName") $OriginalFilename = ReadProfileString($iniFile, $AppSection, "OriginalFileName") $OriginalPath = ReadProfileString($iniFile, $AppSection,"OriginalPath") $UpdateFilename = ReadProfileString($iniFile, $AppSection, "UpdateFileName") $UpdatePath = ReadProfileString($iniFile, $AppSection,"UpdatePath") EndIf $NetApp = $UpdatePath + "\" + $UpdateFilename $LocalApp = $OriginalPath + "\" + $OriginalFilename $lblStatus.Text = "Checking for " + $DisplayName + "..." Sleep 0.25 If Exist($LocalApp) $NetVer = GetFileVersion($UpdateFilename,"FileVersion") $lblStatus.Text = "Checking " + $DisplayName + " version..." $LocalVer = GetFileVersion($OriginalFilename,"FileVersion") If $LocalVer <> $NetVer $lblStatus.Text = "Updating " + $DisplayName + ", please be patient..." Copy $NetApp $LocalApp /h /r /c $lblStatus.Text = $DisplayName + " updated..." Sleep 0.25 EndIf EndIf Next Exit 0 EndFunction
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1376 anonymous users online.
|
|
|