Sign in to follow this  
Followers 0
logmein

AUTO-SYNC

2 posts in this topic

Here the source :

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         LogMeIn

#ce ----------------------------------------------------------------------------

#include <Constants.au3>

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1)
HotKeySet ('^!x','exitt')

Dim $key = 'HKLM\SOFTWARE\AUTO-SYNC'

_checkfirstrun ()

TraySetOnEvent ($TRAY_EVENT_PRIMARYUP,'backup')
TraySetToolTip ('          AUTO-SYNC v 1.0' & @CRLF & @CRLF & 'LogMeIn - www.autoitscript.com' & @CRLF & 'minhthanh.autoit@gmail.com' &  @CRLF & 'Press Ctrl + Alt + X to Exit')
While 1
    Sleep (50)
WEnd


Func _checkfirstrun ()
    If RegRead ($key,'Executed') = '' Then
        $source = FileSelectFolder ('Please choose source folder',@desktopdir,5)
        If $source = '' Then
            _Exit ()
        Else
            $s = $source
            $desti = FileSelectFolder ('Please choose destination folder',@desktopdir,5)
            If $desti = '' Then
                _Exit ()
            Else
                $des = $desti
                RegWrite ($key,'Source','REG_SZ',$s)
                RegWrite ($key,'Destination','REG_SZ',$des)
                RegWrite ($key,'Executed','REG_SZ','true')
                Return
            EndIf
            
        EndIf
    Else
        Return
    EndIf
    
EndFunc

Func backup ()
    If FileExists (Regread ($key,'Source')) = 0 and FileExists (Regread ($key,'Destination')) Then
        MsgBox (16,'Error!','Source/Destination Directory doesn''t exists! Please restart the program!');manually change it by change the value in the following registry keys:' & @crlf & $key & '\Source' & @crlf & $key & '\Destination' & @crlf & @crlf & 'Or you can delete this key : ' & $key & '\Executed' & @crlf & 'and restart the program.')
        _Exit ()
    EndIf
    $pro = DirCopy  (RegRead ($key,'Source'),RegRead ($key,'Destination'),1)
    If $pro = 0 Then
        MsgBox (32,'Error','Error while copy process!')
        Return
    Else
        MsgBox (64,'Msg','Done!',5)
        Return
    EndIf
EndFunc

Func _exit ()
    RegDelete ($key,'Executed')
    
    Exit
EndFunc

Func exitt ()
    Exit
EndFunc

and full exe file : http://www.mediafire.com/?1dwymtjmwzm

ENJOY!!!

(to exit, please press CTRL + ALT + X)

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