03-11-2017, 11:15 AM
I had problems creating a proper method to launch QM code when windows is IDLE for ### seconds.
Even with the function "GetIdleTime", I used this method to create a QM way of handling it:
http://stackoverflow.com/questions/1682 ... er-is-idle
I created an elaborate youtube video tutorial here:
https://www.youtube.com/watch?v=26BamQ76VsI
Or you can use the below "short" explanation:
..........................................
STEP 1: create below qm functions
..........................................
- "_SCREENSAVER_TASKS_PRE" , then right click on it, go to 'Item properties' , goto tab 'Common Properties' take note of it's GUID below in the 'Common Properties' tab
- "_SCREENSAVER_TASKS_POST" , then right click on it, go to 'Item properties' , goto tab 'Common Properties' take note of it's GUID below in the 'Common Properties' tab
Within QM in the itemslist on the left, right click on "_SCREENSAVER_TASKS_PRE" then select 'Item properties'
1. in the first tab "Trigger", below you see the 'Cmdline...'-button, click it. The QM command line for that item is copied to clipboard (paste it in STEP 2)
2. in tab "Common Properties" take note of it's GUID below in the "Common Properties" tab, you must also paste it in STEP 2 Repeat this for "_SCREENSAVER_TASKS_POST"
..........................................
STEP 2: create below qm function "_SCREENSAVER_MAINEXEC"
compile to exe and rename extension to '.scr', it contains 3 lines.
And paste the GUID's correctly below. The first and third line you paste from clipboard (see STEP 1)
Below you see "##### PASTE GUID HERE###", this is the GUID and it is explained in STEP 1
..........................................
Macro _INFO_SCREENSAVER_EXEC_TASKS
Line 1: _SCREENSAVER_TASKS_PRE: executes commands BEFORE screensaver starts
Line 2: executes screensaver, ALWAYS PRESENT
Line 3: _SCREENSAVER_TASKS_PRE: executes commands AFTER screensaver is finsished
..........................................
STEP 3: After you created the above function, do (take note) of the following:
..........................................
* Why line 2 must always be present:
If you don't "start" the screensaver then it will block until you interrupt it, and then run the end program.
http://stackoverflow.com/questions/1682 ... er-is-idle
* Line 1 and 3: Execute the the pre and post actions within the QM functions on line 1 and 3
* Compile "_SCREENSAVER_MAINEXEC" which has the 3 lines to exe and rename the extension to '.scr' and set windows registry key "HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE" To the path of "_SCREENSAVER_MAINEXEC.scr"
* Make sure you have a correct timeout (time idle for screensaver (and qm tasks) to run!)
HKEY_CURRENT_USER\Control Panel\Desktop\ScreenSaveTimeOut
(value 60 = 1 minute, minimum value of "ScreenSaveTimeOut" is 60)
EDIT 1:
This is all tested only on Windows 7, the above path to the screensaver (C:\Windows\system32\Mystify.scr) is based on windows7
I think the above described method also works for Windows 8 and 10.
Other available default screensavers in Windows 7:
C:\Windows\system32\Bubbles.scr
C:\Windows\system32\Mystify.scr
C:\Windows\system32\PhotoScreensaver.scr
C:\Windows\system32\Ribbons.scr
C:\Windows\system32\ssText3d.scr
Even with the function "GetIdleTime", I used this method to create a QM way of handling it:
http://stackoverflow.com/questions/1682 ... er-is-idle
I created an elaborate youtube video tutorial here:
https://www.youtube.com/watch?v=26BamQ76VsI
Or you can use the below "short" explanation:
..........................................
STEP 1: create below qm functions
..........................................
- "_SCREENSAVER_TASKS_PRE" , then right click on it, go to 'Item properties' , goto tab 'Common Properties' take note of it's GUID below in the 'Common Properties' tab
- "_SCREENSAVER_TASKS_POST" , then right click on it, go to 'Item properties' , goto tab 'Common Properties' take note of it's GUID below in the 'Common Properties' tab
Within QM in the itemslist on the left, right click on "_SCREENSAVER_TASKS_PRE" then select 'Item properties'
1. in the first tab "Trigger", below you see the 'Cmdline...'-button, click it. The QM command line for that item is copied to clipboard (paste it in STEP 2)
2. in tab "Common Properties" take note of it's GUID below in the "Common Properties" tab, you must also paste it in STEP 2 Repeat this for "_SCREENSAVER_TASKS_POST"
..........................................
STEP 2: create below qm function "_SCREENSAVER_MAINEXEC"
compile to exe and rename extension to '.scr', it contains 3 lines.
And paste the GUID's correctly below. The first and third line you paste from clipboard (see STEP 1)
Below you see "##### PASTE GUID HERE###", this is the GUID and it is explained in STEP 1
..........................................
Macro _INFO_SCREENSAVER_EXEC_TASKS
;; "F:\portableapps\quickmacrosportable_dev\App\QuickMacros\qmcl.exe" is the FULL path to MY 'qmcl.exe'
;; When you generate the command-line, in STEP 1 your path will be different!
;; Do NOT use QM $$-paths, with this I mean do NOT use: "$qm$\qmcl.exe". Use the FULL PATH!!!!
;; And do NOT forget to paste the GUID you see indicated below in "##### PASTE GUID HERE###" (replace that with GUID!)
run "F:\portableapps\quickmacrosportable_dev\App\QuickMacros\qmcl.exe" "M ''{##### PASTE GUID HERE###}_SCREENSAVER_TASKS_PRE''"
run "C:\Windows\system32\Mystify.scr" "/s"
run "F:\portableapps\quickmacrosportable_dev\App\QuickMacros\qmcl.exe" "M ''{##### PASTE GUID HERE###}_SCREENSAVER_TASKS_POST''"
Line 1: _SCREENSAVER_TASKS_PRE: executes commands BEFORE screensaver starts
Line 2: executes screensaver, ALWAYS PRESENT
Line 3: _SCREENSAVER_TASKS_PRE: executes commands AFTER screensaver is finsished
..........................................
STEP 3: After you created the above function, do (take note) of the following:
..........................................
* Why line 2 must always be present:
If you don't "start" the screensaver then it will block until you interrupt it, and then run the end program.
http://stackoverflow.com/questions/1682 ... er-is-idle
* Line 1 and 3: Execute the the pre and post actions within the QM functions on line 1 and 3
* Compile "_SCREENSAVER_MAINEXEC" which has the 3 lines to exe and rename the extension to '.scr' and set windows registry key "HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE" To the path of "_SCREENSAVER_MAINEXEC.scr"
* Make sure you have a correct timeout (time idle for screensaver (and qm tasks) to run!)
HKEY_CURRENT_USER\Control Panel\Desktop\ScreenSaveTimeOut
(value 60 = 1 minute, minimum value of "ScreenSaveTimeOut" is 60)
EDIT 1:
This is all tested only on Windows 7, the above path to the screensaver (C:\Windows\system32\Mystify.scr) is based on windows7
I think the above described method also works for Windows 8 and 10.
Other available default screensavers in Windows 7:
C:\Windows\system32\Bubbles.scr
C:\Windows\system32\Mystify.scr
C:\Windows\system32\PhotoScreensaver.scr
C:\Windows\system32\Ribbons.scr
C:\Windows\system32\ssText3d.scr