jon0881 Posted March 19, 2008 Share Posted March 19, 2008 Hi Guys and Gals, My AutoIT skills are not high enough yet for me to be able to write something for this. Im hoping someone can help; We have an application that regularly updated. The app is very simple and an upgrade is as simple as installing the new application on a host pc, copy the program files folder and paste them onto the client pc's. Some users have moved over to a terminal server to launch the app but we need to move everyone back. Im basically after a script (pref with a nice front end instead of a robocopy window) that will be on a network drive. Each client will have a shortcut to the script on the desktop. Once launched it will compare the files on the client pc with the client files on the network. If out of date, update the client files and then of course launch the application. Any help would be great! Regards Jon Link to comment Share on other sites More sharing options...
Wheebo Posted March 19, 2008 Share Posted March 19, 2008 hi , do mean something like this ? expandcollapse popup;Includes #include <GUIConstants.au3> #include <Array.au3> #include <File.au3> GUICreate("version", 200, 300,-1,-1,-1,$WS_EX_TOOLWINDOW) $exit = GUICtrlCreateButton("Exit[ Kill ]",49, 265, 100, 30) GUICtrlCreateLabel("Check Version of :",49,10) $NF4 = GUICtrlCreateButton("NF4",49,40,100,30) ;<---- CLIENT VERSIONEN BEGIN ----> $vNF4 = FileGetVersion(@ScriptDir & "\install-exe\Board-NF4\NF4.exe") ;<---- CLIENT VERSION END ----> $DriverDir = IniRead("\\kassen-server\C$\Login\System\Data\DataBase.ini", "Locations", "Driver", "\\kassen-server\D$\Login\Driver") ;<- place ur server here ;<---- SERVER VERSIONEN BEGIN ----> $kNF4 = FileGetVersion($DriverDir & "\NF4\NF4.exe") ;<---- KASSEN VERSIONEN END ----> GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $exit Exit Case $NF4 $msg = 0 If $vNF4 <> $kNF4 Then $msg = MsgBox(4,"Announcement","There is eventually a newer version on the server." & @CRLF & "Serverversion : " & $kNF4 & @CRLF & "Clientversion : " & $vNF4 & @CRLF & "Replace Data ?") Else MsgBox(0,"Up2Date","There is no newer version on the server.") EndIf if $msg = 6 Then if FileCopy($DriverDir & "\NF4\NF4.exe", @ScriptDir & "\install-exe\Board-NF4\",1) then MsgBox(64,"Replaced","Files were successfully replaced.") Else MsgBox(64,"Error","Data has not been replaced.") EndIf EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
jon0881 Posted March 19, 2008 Author Share Posted March 19, 2008 That looks just like what im after, i just hope i know enough to adapt it to my environment. Link to comment Share on other sites More sharing options...
Wheebo Posted March 19, 2008 Share Posted March 19, 2008 I just testet it , it works 100% fine for me , but you will have to change the $DriverDir to your server+fileFolder. then is HAS to work. to change the names of the rest eG. NF4 -> YourProgram.exe is easy --- just change it ^^ and u maybe need this : DataBase.ini [Locations] Driver=\\kassen-server\D$\Login\Driver change this too . Link to comment Share on other sites More sharing options...
weaponx Posted March 19, 2008 Share Posted March 19, 2008 Here is another option, this is more of a generic file date comparison. expandcollapse popup#include <date.au3> ;Declare array to store files to be checked Dim $fileArray[3] $fileArray[0] = "config.ini" $fileArray[1] = "program.exe" $fileArray[2] = "images\image.gif" ;Local path $localPath = "C:\test" ;Network path $networkPath = "C:\Copy of test" For $X = 0 to Ubound($fileArray) - 1 $localFile = $localPath & "\" & $fileArray[$X] $networkFile = $networkPath & "\" & $fileArray[$X] ;If local file is missing If NOT FileExists($localFile) Then ConsoleWrite($fileArray[$X] & ": Not found locally" & @CRLF) ;Retrieve file FileMove($networkFile,$localFile,1) ConsoleWrite($fileArray[$X] & ": Retrieved" & @CRLF) ;No need to compare dates ContinueLoop EndIf ;If network file is missing If NOT FileExists($networkFile) Then ConsoleWrite($fileArray[$X] & ": Not found on network, no action taken" & @CRLF) ContinueLoop EndIf ;Get last modified date $alFT = FileGetTime ($localFile,0,2) $anFT = FileGetTime ($networkFile,0,2) ;Convert dates into Date UDF format $localFileTimeString = StringFormat("%s/%s/%s %s:%s:%s", $alFT[0],$alFT[1],$alFT[2],$alFT[3],$alFT[4],$alFT[5]) $networkFileTimeString = StringFormat("%s/%s/%s %s:%s:%s", $anFT[0],$anFT[1],$anFT[2],$anFT[3],$anFT[4],$anFT[5]) ;Determine date difference (in seconds) between local and network $difference = _DateDiff('s',$localFileTimeString,$networkFileTimeString) ;Same If $difference = 0 Then ConsoleWrite($fileArray[$X] & ": Same as network, no action taken" & @CRLF) ;Network file is newer ElseIf $difference > 0 Then ConsoleWrite($fileArray[$X] & ": Outdated" & @CRLF) ;Perform overwrite FileMove($networkFile,$localFile,1) ConsoleWrite($fileArray[$X] & ": Updated" & @CRLF) ;Local file is newer ElseIf $difference < 0 Then ConsoleWrite($fileArray[$X] & ": Newer, no action taken" & @CRLF) EndIf Next Link to comment Share on other sites More sharing options...
jon0881 Posted March 20, 2008 Author Share Posted March 20, 2008 Thanks for the help. I ended up using a basic autoit gui with a robocopy script behind it. Link to comment Share on other sites More sharing options...
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