Sign in to follow this  
Followers 0
newton1171

Replace script while executing

7 posts in this topic

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!

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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

how to? for my application auto update

thanx

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

:P

That looks like just the ticket! Thanx!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0