Wednesday August 7, 2019

Although I’ve set my “global” (PC) backup to be performed every 50 minutes and, on the other hand, my computer is up usually all the time - a 24h/7 backup is not necessarily an optimal choice, mainly because 1) it could be a waste of resources since there is no need to backup anything during my absence at the desk - and 2) as You may remember I’ve set sound notifications both on backup initiation and finish - I don’t want to hear those notifications while I’m sleeping :) .

Keeping all of that in mind I found myself in the need of setting up a smart backup schedule - i.e., the one which could be intelligently flexible, with the ability to adjust to any circumstances at the present moment. You might ask why I didn’t choose a fixed timespan for my backup mechanism to be performed? - the answer is that I don’t have a regular, predictable hours to point out (sometimes I turn in earlier, another times I work until the wee small hours of the morning). So the only choice seems to be a solution which could detect that I’m not at the computer for long enough - and, therefore, deactivate the backup. Besides, it should activate it again when I’m back again. Easier said than done ;) .

How to schedule an action based on the idle time?

Initially I tried to write a script within AutoHotkey. Finally I’ve managed to prepare one, based on this solution. which was able to detect a long-enough idle time and kill the desired process (GoodSync.exe) - but I couldn’t figure out how to restore it when the idle time is over. I was thinking on detecting a mouse move or a keyboard activity - but it seems not to make sense because it should work only in connection to the idle time - not covering all the rest mouse/keyboard activity instances. So I’ve found myself in confusion.

My current ray of hope is the Watch 4 Idle tool by LeeLu Soft - a small freeware program with which You can ascribe actions both to the beginning and end of a desired idle time span.

Watch 4 Idle 1.2 in action.

Sounds brilliant! :) So... the last thing I needed was a simple AutoHotkey script to kill the backup process, being converted into an .exe file (in order to be reachable by Watch 4 Idle - just right click an .ahk file with Your script and choose Compile Script). The action for leaving the idle time was much simpler: just run the GoodSync again (from the Program Files).

A good idea to keep in mind: the app which has been launched automatically, naturally shows its window on the desktop (let alone the icon on the taskbar). As a result You might want to close this window every time it appears.

Fortunately, sometimes it is possible to avoid this occurrence by forcing an app to be launched directly within Windows tray (so no window on the desktop, neither a taskbar icon). To do so, first You need to find out if the app supports so-called run parameters (or arguments). In case of GoodSync I’ve found this within its manual:

/min or /tray
Run minimized, only taskbar icon is visible.”

So I’ve been able to write my AutoHotkey script (to launch GoodSync after idle time) the following way:

Run "C:\Program Files\Siber Systems\GoodSync\GoodSync.exe" /tray

return

The last thing to do was to convert this script into an executable form (right click on its icon and choose Compile Script), which to I could point out within Watch 4 Idle.

Currently I’m testing if this solution really works. For a short period of time (5 sec.) it does - but with the desired value (3300 sec.) it hasn’t worked the last night (I’ve read the GoodSync's logs :) ). So... I’m still taking a closer look on this (see the results). But in theory it seems to be a perfect solution, and on top of that You can use a portable app which You even don’t need to install :) . Moreover, the developer of Watch 4 Idle designed more neat and useful (freeware) tools which are very interesting to become acquainted with - highly recommended :) .

Filed in: /37/ | /37/ | /56/ | /7/ | /35/ | /9/ | /1/ | /2/

Your (nick)name:

Your e-mail:

Have a website?

Your message:

remember data for further comments?