Use windows screensaver to launch QM code

Post here your macros, QM projects, solutions, etc.

Use windows screensaver to launch QM code

Postby r0n on Sat Mar 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     ?
;; "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
r0n
Active Member
 
Posts: 498
Joined: Tue Jul 24, 2012 5:47 am

Re: Use windows screensaver to launch QM code

Postby kyjdp on Mon Mar 13, 2017 11:12 pm

Hello, r0n

Word processing, is the daily work often need to operate,
QM by default operating text, can not keep some character format, so I hope you can record some Word software aspects of the video tutorial (using word typelib):

E.g:

1. Use QM to open, create, save dos document

2. Use qm to change the character format in word

3. Use qm to change the paragraph format in word

4. Use qm to change the page format in word

5. Use QM's regular expression to find and replace characters (Word regular expression is not standardized, QM is very standardized)

Thank you very much for recording the tutorial, so I learned a lot of programming knowledge :)
Last edited by kyjdp on Mon Mar 13, 2017 11:17 pm, edited 1 time in total.
kyjdp
 
Posts: 275
Joined: Wed Dec 21, 2016 7:48 am

Re: Use windows screensaver to launch QM code

Postby kyjdp on Mon Mar 13, 2017 11:16 pm

VBA syntax, some long-winded, QM syntax is relatively simple, so I hope you can contrast to explain a VBA and QM operating syntax, this will make people better understand the strong QM programming :arrow:
kyjdp
 
Posts: 275
Joined: Wed Dec 21, 2016 7:48 am


Return to My QM

Who is online

Users browsing this forum: No registered users and 2 guests

cron