Hi there,
I am attempting to script a small program that will automatically Synchronize a drive (using SyncToy). I have managed to get it to do that, but i would also like to add an item in the tray menu that will Sync immediately (eg. Sync Now)
I have got both parts working in separate scripts, but cannot find a way to combine them. Both scripts are below:
NB: For the purposes of the script below, i have made it open notepad (commented out the synctoy specific sections) instead of SyncToy as the SyncToy profile is specific to my computer
Tray Menu:
#NoTrayIcon
Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.
$syncnow = TrayCreateItem("Sync Now")
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
$exititem = TrayCreateItem("Exit")
TraySetState()
TraySetToolTip("AutoSync")
;TraySetIcon("C:\Program Files\SyncToy 2.1\SyncToyCmd.exe", 1)
While 1
$msg = TrayGetMsg()
Select
Case $msg = 0
ContinueLoop
Case $msg = $syncnow
SyncNow()
Case $msg = $aboutitem
Msgbox(64, "about:", "Automatically Syncronises H Drive every 10 minutes")
Case $msg = $exititem
ExitLoop
EndSelect
WEnd
Func SyncNow()
;Run('"C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -R "H Drive Sync"')
Run("notepad.exe")
EndFunc
Automatic Sync:
;#NoTrayIcon
#include <get_dns.au3>; Get the current Local DNS Suffix
While $dnsfullname = $dnsfullname; Always TRUE for the purposes of testing
Sync()
WEnd
Func Sync()
;Run('"C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -R "H Drive Sync"')
Run("notepad.exe")
Sleep(300000)
EndFunc
Is there a way to combine these scripts so i can have the autosync feature as well as being able to right-click the tray icon and "Sync Now"?
Thanks in advance
pikelet650
get_dns.au3
AutoSync.au3
TrayMenuSync.au3