Jump to content

Hotkey And Blockinput


Joon
 Share

Recommended Posts

Here is what I am trying to do. Time to time, I'm letting my 4 years old boy watch movies on my laptop. The problem is he is not just watching movie, he is pushing keyboard and touchpad. That stops the movie and meshs up my laptop. BlockInput function works well but it also become bothersome for me also. So... I like to toggle BlockInput and the problem is BlockInput also blocks HotKey... is there a way around it?

other than CTRL-ALT-DELETE.

Link to comment
Share on other sites

  • Moderators

Here is what I am trying to do. Time to time, I'm letting my 4 years old boy watch movies on my laptop. The problem is he is not just watching movie, he is pushing keyboard and touchpad. That stops the movie and meshs up my laptop. BlockInput function works well but it also become bothersome for me also. So... I like to toggle BlockInput and the problem is BlockInput also blocks HotKey... is there a way around it?

other than CTRL-ALT-DELETE.

Put it on a Timer... so you can enter the length of the movie?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

I like to be able to quickly unlock and do something then lock it again.

Then if it's for personal use, what's wrong with CTRL+ALT+DELETE?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Then if it's for personal use, what's wrong with CTRL+ALT+DELETE?

I agree

After you hit Ctrl+Alt+Del, just hit Esc to dismiss the task manager / dialog window....

; Use Pause to lock keyboard, Ctrl+Alt+Del to unlock
HotkeySet("{Pause}", "lockKeyboard")

While 1
    sleep(100)
Wend


Func lockKeyboard()
    BlockInput(1)
EndFunc

The only other strategy would be a mapping a bunch of hotkeys to do nothing, but I believe there is a limit on the number of simultaneous hotkeys, and it could be hard to cover alt Alt/Shift/Ctrl/... combintaions.

For $i = Asc("a") to Asc("Z")
    HotkeySet(Chr($i), "doNothing")
Next
While 1
    sleep(100)
Wend

Func DoNothing()
EndFunc
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

  • Moderators

but I believe there is a limit on the number of simultaneous hotkeys, and it could be hard to cover alt Alt/Shift/Ctrl/... combintaions.

64 Hotkeys isn't it?

Edit:

Cleaned up to specify the statement.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

After you hit Ctrl+Alt+Del, just hit Esc to dismiss the task manager / dialog window....

Nothings wrong just more extra step. doing it so also looses full screen view of movie player.

1. CTRL+ALT+DEL, if i'm doing something else it's not easy doing it with one hand.

2. ESC to getting back to Desktop.

3. Make movie full screen again.

4. Reume Script. If I don't do it right, I get taskbar at the bottom with Full Screen and mouse and keyboard locked! --> Back to Step 1.

Compare to HotKey toggle(if possible), that's awful lots of steps.

Link to comment
Share on other sites

I've tried looking into the one key thing.. but it locks all keys and mouse while running :) maybe someone more experience should know.. any ways.. if your children happend to be pressing keys wouldn't it be smart it make it hard to disable? :mellow:

; Use Pause to lock keyboard, Ctrl+Alt+Del to unlock
HotkeySet("{esc}", "_kill")
HotkeySet("{Pause}", "lockKeyboard")
;HotkeySet("{pgup}", "_unlockKeyboard")

While 1
    _unlockKeyboard()
    sleep(1000)
Wend

Func lockKeyboard()
    BlockInput(1)
;while 1 
    ;_unlockKeyboard()
;wend
EndFunc

Func _unlockKeyboard()
    if ProcessExists("taskmgr.exe")then
    ProcessClose("taskmgr.exe")
   ;send("!^{del}")
;sleep(200)
;send("esc")
    endif
EndFunc

Func _kill()
    Exit
endfunc
Link to comment
Share on other sites

the way that i'd go, is to set hotkeys to capture the player's hotkeys, also for the ctrl, alt, esc etc, then use _mousetrap(), and have a hotkey that toggles all of that. no need to block EVERY key, i mean i bet 80% of the keys do nothing if pressed while watching a movie.

Link to comment
Share on other sites

I don't even see task manager with this and i've found good use for it... :mellow: that tells you, i've learn something :)

; Use Pause to lock keyboard, Ctrl+Alt+Del to unlock
HotkeySet("{esc}", "_kill")
HotkeySet("{Pause}", "lockKeyboard")

While 1
    if ProcessExists("taskmgr.exe")then
    ProcessClose("taskmgr.exe")
    EndIf
Wend

Func lockKeyboard()
    BlockInput(1)
EndFunc

Func _kill()
    Exit
endfunc
Edited by slightly_abnormal
Link to comment
Share on other sites

I don't even see task manager with this and i've found good use for it... :mellow: that tells you, i've learn something :)

; Use Pause to lock keyboard, Ctrl+Alt+Del to unlock
HotkeySet("{esc}", "_kill")
HotkeySet("{Pause}", "lockKeyboard")

While 1
    if ProcessExists("taskmgr.exe")then
    ProcessClose("taskmgr.exe")
    EndIf
Wend

Func lockKeyboard()
    BlockInput(1)
EndFunc

Func _kill()
    Exit
endfunc
should probably throw a sleep in there too, eating up too much processor time may be detrimental to your movie watching enjoyment.
Link to comment
Share on other sites

I've tried looking into the one key thing.. but it locks all keys and mouse while running :mellow: maybe someone more experience should know.. any ways.. if your children happend to be pressing keys wouldn't it be smart it make it hard to disable? :)

; Use Pause to lock keyboard, Ctrl+Alt+Del to unlock
HotkeySet("{esc}", "_kill")
HotkeySet("{Pause}", "lockKeyboard")
;HotkeySet("{pgup}", "_unlockKeyboard")

While 1
    _unlockKeyboard()
    sleep(1000)
Wend

Func lockKeyboard()
    BlockInput(1)
;while 1 
;_unlockKeyboard()
;wend
EndFunc

Func _unlockKeyboard()
    if ProcessExists("taskmgr.exe")then
    ProcessClose("taskmgr.exe")
  ;send("!^{del}")
;sleep(200)
;send("esc")
    endif
EndFunc

Func _kill()
    Exit
endfunc

Thanks, I can settle with this... :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...