Disable mouse and keyboard
Moderators: Dorian (MJT support), JRL
-
- Pro Scripter
- Posts: 110
- Joined: Thu Apr 08, 2010 6:11 am
- Location: Hørsholm, Denmark
- Contact:
Disable mouse and keyboard
Hi,
Is there a way to disable the mouse ande keyboard except for an key combination to stop the script..?
I would like to make shure that the user is uanble to interrupt the macro
by moving the mouse ot typing stuff
Is there a way to disable the mouse ande keyboard except for an key combination to stop the script..?
I would like to make shure that the user is uanble to interrupt the macro
by moving the mouse ot typing stuff
Best Regards
Steen Jakobsen
DM Software A/S
Steen Jakobsen
DM Software A/S
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Use the BlockInput command.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 18
- Joined: Thu Mar 25, 2010 11:00 am
- Location: Vancouver
Using Blockinput>1 will make any keyboard and mouse input do nothing. However even the stop script command wont work.
If a script has blockinput>1 turned on the only way to prematurely stop it is to press control alt delete.
Even running an onevent routine at the start of the script wont work.
"Be aware that this prevents all user input apart from CTRL-ALT-DEL. If you need to stop a running script that has blocked input press CTRL-ALT-DEL and then stop the script."
Taken from the help file for blockinput
Just try to keep the scripts short and make sure every exit path includes blockinput>0 to give control back to the user after everything is said and done.
I'd suggest using the blockinput command as previously suggested but include a small write up so people know to press ctrl alt delete if they need to stop it from running manually
If a script has blockinput>1 turned on the only way to prematurely stop it is to press control alt delete.
Even running an onevent routine at the start of the script wont work.
"Be aware that this prevents all user input apart from CTRL-ALT-DEL. If you need to stop a running script that has blocked input press CTRL-ALT-DEL and then stop the script."
Taken from the help file for blockinput
Just try to keep the scripts short and make sure every exit path includes blockinput>0 to give control back to the user after everything is said and done.
I'd suggest using the blockinput command as previously suggested but include a small write up so people know to press ctrl alt delete if they need to stop it from running manually
-
- Pro Scripter
- Posts: 110
- Joined: Thu Apr 08, 2010 6:11 am
- Location: Hørsholm, Denmark
- Contact:
-
- Pro Scripter
- Posts: 110
- Joined: Thu Apr 08, 2010 6:11 am
- Location: Hørsholm, Denmark
- Contact:
Hi ,
I have implementet the BlockInput>1 command
And it works fine.
Is there a way op detect if the user has pressed ctrl-alt-delete
and then to call a SRT to terminate the script and do some cleanup..?
Currently I have an OnEvent key combination that does that but the key combination does of course not
work when BlockInput is active.
I have implementet the BlockInput>1 command
And it works fine.
Is there a way op detect if the user has pressed ctrl-alt-delete
and then to call a SRT to terminate the script and do some cleanup..?
Currently I have an OnEvent key combination that does that but the key combination does of course not
work when BlockInput is active.
Best Regards
Steen Jakobsen
DM Software A/S
Steen Jakobsen
DM Software A/S
Here's a possibility. I've never been able to get an Onevent to detect Ctrl+Alt+Del so what I've done for XP is use Onevent to detect the Task Manager window.Is there a way op detect if the user has pressed ctrl-alt-delete
and then to call a SRT to terminate the script and do some cleanup..?
I know that Win 2000 and Vista bring up a Window prior to Task MAnager. I looked up the name of the window and found it to possibly be "Windows Security" but I'm not sure. I also don't know if this is the same name in Win 7. Any way the XP part the following has been used by me in many scripts over the past few years and I know it works reliably
Code: Select all
BlockInput>1
OnEvent>Window_Open,Windows Task Manager,2,WTMpressed
OnEvent>Window_Open,Windows Security,2,WSpressed
SRT>WTMpressed
SetFocus>Windows Task Manager
Press esc
MDL>Continue Without Input Blocked
Exit>0
END>WTMpressed
SRT>WSpressed
SetFocus>Windows Security
Press esc
MDL>Continue Without Input Blocked
Exit>0
END>WSpressed
Label>Loop
Wait>0.01
Goto>Loop
-
- Pro Scripter
- Posts: 110
- Joined: Thu Apr 08, 2010 6:11 am
- Location: Hørsholm, Denmark
- Contact:
-
- Pro Scripter
- Posts: 110
- Joined: Thu Apr 08, 2010 6:11 am
- Location: Hørsholm, Denmark
- Contact:
Works fine for me. I've tried it on several machines and I've been using the technique for quite a while. Perhaps add an asterisk to the end of each of the window names.
Windows Task Manager*
Windows Task Manager*
Define "nothing". If the script works properly you might see a blip after pressing ctrl+alt+del as Task Manager opens and closes, then a Macro Scheduler modal message should open. If the script doesn't work, after pressing ctrl+alt+del you should see Task Manager.I'm using XP and nothing happens
-
- Pro Scripter
- Posts: 110
- Joined: Thu Apr 08, 2010 6:11 am
- Location: Hørsholm, Denmark
- Contact:
Hi JRL (and Marcus)
Well I can get it to detect when "Task Manager" is opened..
But not the "Window Security" window wich opens when the user press Ctrl-Alt-Del.. In danish : "Windows Sikkerhed"
Any clue.. ? (using XP SP3)
Marcus: if you are listening in ... .. it wold be great to be able to detect Ctrl-Alt-Del in OnEvent and then jump to a SRT to terminate the script and perform any nessecary cleanup and so on.
As it is now I have to declare a diffreent key combination and inscruct the user to:
1. Press Ctrl-Alt-Del
2. Press ESC
3. Press My third key combination
The users experience would be so much better it the whole thing could be handled in one single OnEvent SRT triggered by Ctrl-Alt-Del.
Any feedback on this is most appreciated.
Well I can get it to detect when "Task Manager" is opened..
But not the "Window Security" window wich opens when the user press Ctrl-Alt-Del.. In danish : "Windows Sikkerhed"
Any clue.. ? (using XP SP3)
Marcus: if you are listening in ... .. it wold be great to be able to detect Ctrl-Alt-Del in OnEvent and then jump to a SRT to terminate the script and perform any nessecary cleanup and so on.
As it is now I have to declare a diffreent key combination and inscruct the user to:
1. Press Ctrl-Alt-Del
2. Press ESC
3. Press My third key combination
The users experience would be so much better it the whole thing could be handled in one single OnEvent SRT triggered by Ctrl-Alt-Del.
Any feedback on this is most appreciated.
Best Regards
Steen Jakobsen
DM Software A/S
Steen Jakobsen
DM Software A/S
-
- Newbie
- Posts: 18
- Joined: Thu Mar 25, 2010 11:00 am
- Location: Vancouver
I don't think macro scheduler is able to detect the windows security window when it gets opened. When running the script JRL posted and having it not work I decided to try out a getactivewindow script to see if the window title was incorrect.
Run that and you will have 5 seconds to get the window open. Press control alt delete, wait 5 seconds then close it.
The script will have finished and the message will read ",0,0" Which I'm assuming means that there was no active window detected.
Unless I'm doing something wrong. Either way just thought I would post this to try and help others.
Code: Select all
wait>5
GetActiveWindow>window_title,X,Y
Message>%window_title%,%X%,%Y%
The script will have finished and the message will read ",0,0" Which I'm assuming means that there was no active window detected.
Unless I'm doing something wrong. Either way just thought I would post this to try and help others.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Essentially, it's not possible to trap ctrl-alt-del:
http://stackoverflow.com/questions/2090 ... detects-it
Microsoft don't let apps see it.
In Win7 if you hit ctrl-alt-del the desktop goes away and you get a the logon window with options to lock, switch user, log off, change password or start task manager. I'm guessing this is the security console, which is running under a different context, and Macro Scheduler is never going to see it.
It _might_ be possible via a custom keyboard driver or winlogon replacement. But these are advanced things which have their own implications and should be left to the experienced Windows developer - and not things you can do with Macro Scheduler.
http://stackoverflow.com/questions/2090 ... detects-it
Microsoft don't let apps see it.
In Win7 if you hit ctrl-alt-del the desktop goes away and you get a the logon window with options to lock, switch user, log off, change password or start task manager. I'm guessing this is the security console, which is running under a different context, and Macro Scheduler is never going to see it.
It _might_ be possible via a custom keyboard driver or winlogon replacement. But these are advanced things which have their own implications and should be left to the experienced Windows developer - and not things you can do with Macro Scheduler.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Pro Scripter
- Posts: 110
- Joined: Thu Apr 08, 2010 6:11 am
- Location: Hørsholm, Denmark
- Contact:
Re: Disable mouse and keyboard
Macro Scheduler may not be able to "Trap" Ctrl + Alt + Del, but ten years later (and using Windows 10) I think I figured out how to "Detect" Ctrl + Alt + Del. Turns out that when the login or the logout screens are visible, GetPixelColor detects any chosen point on the desktop as the color "-1". And OnEvent> will detect The Ctrl + Alt key combination. So a solution is to loop in OnEvent> while ctrl + alt is pressed waiting for a pixel to turn to color -1.Marcus wrote:Essentially, it's not possible to trap ctrl-alt-del:
Make sure the chosen point is on the desktop because choosing a point off the desktop with GetPixelColor> will always produce a -1 result.
This seems to reliably detect Ctrl + Alt + Del being pressed.
Code: Select all
OnEvent>key_down,VK17,5,srtCtrlAlt
Label>Loop
Wait>0.01
Goto>Loop
SRT>srtCtrlAlt
GetPixelColor>1,1,vColor
If>vColor=-1
MDL>Ctrl+Alt+Del Pressed
Exit>0
EndIf
END>srtCtrlAlt