 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Just eat the damn oranges
Joined: 31 Oct 2009 Posts: 2
|
Posted: Sat Oct 31, 2009 4:33 am Post subject: Need help with combining AHK and a locking app. |
|
|
I apologize for the vague topic.
I use a program called ToddlerKeys. Its icon resides permanently in the system tray, and when double-clicked it blocks all keyboard input as well as mouse clicks (except for CTRL+ALT+ESC etc). It only unlocks when "toddlerkeys" is typed in.
I was hoping there was some way I could get AHK to bind my Scroll Lock or Pause key to ToddlerKeys' lock function -- which is currently only available by doubleclicking an icon. Is there any way that could be done?
If not, is there any way I can get a similar function out of AHK? Press Pause, all mouse+keyboard input is blocked until you hit Capslock, something like that? |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 1158 Location: San Diego, California
|
Posted: Sat Oct 31, 2009 8:13 am Post subject: |
|
|
I prefer the good oranges
and you should consider searching the forum next time
http://www.autohotkey.com/forum/viewtopic.php?t=20601&highlight=toddler
See if you can get that to work as you want it, probably have to modify the hotkeys, or your expectation of how the old program works.
| Quote: | | I use a program called ToddlerKeys. Its icon resides permanently in the system tray |
if you can't get it to work, I also have script that looks for an icon and "does something" it could be made to click the icon. |
|
| Back to top |
|
 |
Just eat the damn orange Guest
|
Posted: Sat Oct 31, 2009 10:28 pm Post subject: |
|
|
I saw that one, but the problem is that it doesn't disable mouse-clicks, and isn't enabled/disabled with a hotkey (though I suppose you could set it up that way).
Where can I see your script? |
|
| Back to top |
|
 |
Scratch
Joined: 22 Jan 2009 Posts: 59
|
Posted: Sat Oct 31, 2009 11:15 pm Post subject: |
|
|
| Code: |
#InstallKeybdhook
#UseHook ; Force the use of the hook for hotkeys after this point.
#^{F12}::BlockInput on ; blockinput on will not affect userhook hotkeys
#+{F12}::BlockInput off
#!{F12}::ExitApp
#UseHook off
;
blockinput on
k::
Msgbox but this non hooked hotkey and rest of keyboard will be blocked
|
User Hook will make script run persistent, so an ExitApp must be in the script to terminate it |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 1158 Location: San Diego, California
|
Posted: Sat Oct 31, 2009 11:30 pm Post subject: |
|
|
I was mistaken about the script that checks my email, but this is one I just tested, it checks for an icon in system tray.
I chose AC power by using printscreen and paint to crop an image of what I wanted to find.
The mousemove command could probably be changed to mouseclick or click command.
| Code: | CoordMode, ToolTip, screen
CoordMode, Mouse, screen
CoordMode, Pixel, screen
SysGet, VirtualScreenWidth, 78
SysGet, VirtualScreenHeight, 79
SysGet, VirtualScreenLeft, 76
SysGet, VirtualScreenTop, 77
;=====================================
; the image name to search for, in working directory
;=====================================
image_name= AC_ICON.bmp
ImageSearch, OutputVarX, OutputVarY, VirtualScreenLeft, VirtualScreenTop
, A_ScreenWidth, A_ScreenHeight, %image_name%
if (errorlevel<>0)
{
msgbox For !%image_name%! ErrorLevel was %ErrorLevel% `nErrorLevel is set to 0 if the image was found in the specified region, 1 if it was not found
, or 2 if there was a problem that prevented the command from conducting the search (such as failure
. to open the image file or a badly formatted option). `n`n press OK to exit.
}
else
{
msgbox, , , Upper left corner of %image_name% is at %OutputVarX% %OutputVarY%`n Move the mouse there!, 1 ; Leef_me
mousemove, %OutputVarX%, %OutputVarY%, 50
; my icon is 16 x 16 so I can move to it's approx center by using this
mousemove, OutputVarX+8, OutputVarY+8, 50
msgbox press OK to exit.
} |
|
|
| Back to top |
|
 |
Guest
|
Posted: Sun Nov 01, 2009 2:56 am Post subject: |
|
|
| Scratch wrote: | | Code: |
#InstallKeybdhook
#UseHook ; Force the use of the hook for hotkeys after this point.
#^{F12}::BlockInput on ; blockinput on will not affect userhook hotkeys
#+{F12}::BlockInput off
#!{F12}::ExitApp
#UseHook off
;
blockinput on
k::
Msgbox but this non hooked hotkey and rest of keyboard will be blocked
|
User Hook will make script run persistent, so an ExitApp must be in the script to terminate it |
I'm afraid I'm a total noob when it comes to AHK. Don't the hash marks mean those lines are comments (inactive)? Do I need to write something using those? I'm not sure what that script would do. |
|
| Back to top |
|
 |
Z_Gecko Guest
|
Posted: Sun Nov 01, 2009 4:51 am Post subject: |
|
|
| Quote: | | Don't the hash marks mean those lines are comments (inactive)? |
No, the ; markes a line as comment.
# usually indicates a directive and is a hotkey-modifier
| Quote: | | I'm not sure what that script would do. |
the script is supposed to be a replacement for the ToddlerKeys-program (i canīt test if it really works, because i donīt a have a WinKey)
this version is tested to work,
it will Block all Input on Pause and unblock on CapsLock or when you type "toddlerkeys"
| Code: | #InstallKeybdhook
#UseHook
Pause::
BlockInput on
return
Capslock::
:*?b0:toddlerkeys::
BlockInput off
return
#UseHook off |
|
|
| Back to top |
|
 |
Just eat the damn oranges
Joined: 31 Oct 2009 Posts: 2
|
Posted: Sun Nov 01, 2009 6:38 am Post subject: |
|
|
The first script gets an error at line three ("Invalid hotkey"). The second script doesn't give an error, but doesn't seem to block anything (maybe because of Windows 7?).  |
|
| Back to top |
|
 |
Z_Gecko Guest
|
Posted: Mon Nov 02, 2009 12:56 am Post subject: |
|
|
| Quote: | | The second script doesn't give an error, but doesn't seem to block anything (maybe because of Windows 7?). Sad | I can only assure you that i works on Win2K and XP, no Win7 here.
You might try to run the script as admin,
the method for Vista that is mentioned in the help might work on Win7 too.
| Code: | if not A_IsAdmin
{
DllCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, A_AhkPath
, str, """" . A_ScriptFullPath . """", str, A_WorkingDir, int, 1)
ExitApp
} |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|