newton1171 Posted September 5, 2006 Share Posted September 5, 2006 I have a script that looks at a file share to see if a new version of the script exists. What I would like to and have not found a method is to then copy it over the one that is executing. I tried using; FileCopy ( "\\share\updates\sample.exe", @WorkingDir, 1) while executing sample.exe from a login script. FileCopy returns "0" indicating failure. Any thougts would be appreciated! Link to comment Share on other sites More sharing options...
Xenobiologist Posted September 5, 2006 Share Posted September 5, 2006 Hi, I dunno whether that is possible, but what about copying it, save it with another name. Start it, stop the first one, delete it, rename itself. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
diegonella Posted September 5, 2006 Share Posted September 5, 2006 Hi,I dunno whether that is possible, but what about copying it, save it with another name. Start it, stop the first one, delete it, rename itself.So long,Megahow to? for my application auto updatethanx Link to comment Share on other sites More sharing options...
lod3n Posted September 5, 2006 Share Posted September 5, 2006 Try this: $newexe = "\\share\updates\sample.exe" $myver = FileGetTime (@ScriptFullPath , 0, 1 ) $newver = FileGetTime ($newexe , 0, 1 ) if $newver > $myver Then FileCopy ($newexe, @WorkingDir&"\sample-new.exe", 1) run($newexe, @WorkingDir) Exit EndIf if @ScriptFullPath = @WorkingDir&"\sample-new.exe" Then FileCopy (@ScriptFullPath, @WorkingDir&"\sample.exe", 1) run(@WorkingDir&"\sample.exe",@WorkingDir) Exit EndIf [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
newton1171 Posted September 6, 2006 Author Share Posted September 6, 2006 That looks like just the ticket! Thanx! Link to comment Share on other sites More sharing options...
w0uter Posted September 6, 2006 Share Posted September 6, 2006 rename the old one (while running) then just place the new one. execute the new one and have it delete the old (renamed) one. saves a createprocess call My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
lod3n Posted September 6, 2006 Share Posted September 6, 2006 w0uter, (who is "An Reverser") I've tried that, but in my experience that can be randomly problematic, especially on older machines. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] 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