AutoHotkey Community

It is currently May 26th, 2012, 10:56 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: October 31st, 2009, 5:33 am 
Offline

Joined: October 31st, 2009, 5:29 am
Posts: 2
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2009, 9:13 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6067
Location: San Diego, California
I prefer the good oranges :wink:

and you should consider searching the forum next time
http://www.autohotkey.com/forum/viewtop ... ht=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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2009, 11:28 pm 
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?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 1st, 2009, 12:15 am 
Offline

Joined: January 22nd, 2009, 3:43 pm
Posts: 84
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 1st, 2009, 12:30 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6067
Location: San Diego, California
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.
  }


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 1st, 2009, 3:56 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 1st, 2009, 5:51 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 1st, 2009, 7:38 am 
Offline

Joined: October 31st, 2009, 5:29 am
Posts: 2
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?). :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 1:56 am 
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
}


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: hyper_, JSLover, Kirtman, Leef_me, Maestr0, Miguel, XstatyK and 61 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group