Example scripts and tips (replaces Old Scripts & Tips archive)
Moderators: Dorian (MJT support), JRL, Phil Pendlebury
-
Grovkillen
- Automation Wizard
- Posts: 1120
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Wed Jan 17, 2024 5:11 pm
Here's a proof of concept to have a script run only when the pc is locked. I just look for the process "LogonUI.exe" which is the lock screen. If it's running then the pc is locked. I hope it's help someone.
Code: Select all
OnEvent>CUSTOM,LOOP_TO_CHECK_IF_LOCKED_WORKSTATION,LOGONUI_IS_ACTIVE,RUN_THIS_ONLY_WHEN_SCREEN_LOCKED
Label>start_of_main_loop
Wait>10
Goto>start_of_main_loop
SRT>LOOP_TO_CHECK_IF_LOCKED_WORKSTATION
Let>PID_array_count=0
GetProcessIDs>LogonUI.exe,PID_array
If>PID_array_count>0
Let>LOGONUI_IS_ACTIVE=true
Else>
Let>SECONDS_SINCE_LOCKED=0
Let>LOGONUI_IS_ACTIVE=false
Endif>
END>LOOP_TO_CHECK_IF_LOCKED_WORKSTATION
SRT>RUN_THIS_ONLY_WHEN_SCREEN_LOCKED
Wait>1
Add>SECONDS_SINCE_LOCKED,1
Message>SECONDS_SINCE_LOCKED
END>RUN_THIS_ONLY_WHEN_SCREEN_LOCKED
-
Grovkillen
- Automation Wizard
- Posts: 1120
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Wed Mar 20, 2024 9:26 pm
@Marcus: the GetProcessIDs>LogonUI.exe,PID_array will not return PID_array_count=0 if no processes are found. You might want to add that to the next release. Currently we need to add a Let>PID_array_count=0 before the call just to be sure.
-
Grovkillen
- Automation Wizard
- Posts: 1120
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Sat Sep 21, 2024 5:37 pm
The issue with the array count missing was fixed in 15.0.25