AutoHotkey Community

It is currently May 25th, 2012, 5:13 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 159 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 11  Next
Author Message
 Post subject: ahkosk
PostPosted: September 8th, 2007, 4:18 am 
Offline

Joined: December 1st, 2006, 9:27 am
Posts: 460
The latest version is up. I've added layer support and fixed some things.

Here is the structure for adding layers:
Code:
         <key shift="!" layer1="®" layer2="¶" layer3="Ý">1</key>
         <key shift="@" layer1="Œ" layer2="¿" layer3="Þ">2</key>
         <key shift="#" layer1="ž" layer2="À" layer3="ß">3</key>
         <key shift="$" layer1="©" layer2="Ø" layer3="€">4</key>
Click the "layr" button to toggle.
Thanks for the idea, RedX

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Nice work, but....
PostPosted: October 4th, 2007, 8:45 pm 
Offline

Joined: July 5th, 2006, 6:22 am
Posts: 37
Nice work, just a couple of questions.

First, I find that in its default configuration it doesn't pick up nearly all the key presses if someone presses the keys very rapidly. Adjusting clickUpdateRate in the config file fixes this... Is there an advantage to leaving this at 40? Or at anything above 0?

And is there a way to give the keyboard a transparent background? In other words, make it so it's not an even rectangle, but has edge keys "floating" on a transparent background?

And would it be possible to make the buttons be images instead of blocks? In other words, define the keyboard the same way we are now, but allow an image overlay over each key?

Or another approach might be to allow the user to create their own complete keyboard in, say, Photoshop, and capture keystrokes depending on where their clicks were registered? I'm thinking of kiosk designers and people for whom the aesthetics of the keyboard is extremely important...

Again, really nice work. As I get deeper into its configurations (the ini file and the xml layout) I really really like it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2007, 4:00 pm 
I also think you've got a great piece of software here.

Just an Idea I thought I would toss out.

You should be able to add totally customizable buttons for AHK.

Like a blank row of keys we can label and add function to with our hotkeys.

Thanks for a great product.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 8th, 2007, 8:46 am 
Offline

Joined: December 1st, 2006, 9:27 am
Posts: 460
Thanks for the interest!
Here is a screenshot of what the latest version can do. This is the "english-fancy" layout.

Image

wrybread wrote:
Is there an advantage to leaving this at 40?
At the time, the click detection sub was such a mess that I just left it where it was. I've recently improved that sub, making it faster and more efficient. BTW, I changed this to 15.

wrybread wrote:
give the keyboard a transparent background?
Sure! Check out the latest version. Or this - with no blobs:
Image

wrybread wrote:
make the buttons be images instead of blocks?
I'm looking into this (there are some things floating around the forum about this.) I also am working on round and elliptical buttons.

wrybread wrote:
allow the user to create their own complete keyboard in, say, Photoshop, and capture keystrokes depending on where their clicks were registered?
Sorry, I don't wish to pursue this option. If you or someone else would, I'd be happy to advise.


davez wrote:
You should be able to add totally customizable buttons for AHK.
Like a blank row of keys we can label and add function to with our hotkeys.
What functions are you thinking of? Do you mean macros or Special key combos?


Again, thanks for the feedback and ideas!

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 8th, 2007, 11:31 am 
Offline

Joined: July 5th, 2006, 6:22 am
Posts: 37
Awesome!

Note that the link to the source is broken...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 10th, 2007, 11:45 pm 
Offline

Joined: December 1st, 2006, 9:27 am
Posts: 460
The link is back up! Sorry - I left out a space in the name when I updated. I'll have to come up with something simpler.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Linux support?
PostPosted: October 11th, 2007, 8:26 am 
That is impressive!

I am working on a touch-screen interface keyboard for a "terminal application", in Java, and my idea was simply to map JButtons over each key, which append the desired character to the JTextArea.

Did you solve the problem of capturing simultaneous key combinations, like Shift + H, or Ctrl + Alt + W? The touch screen acts like a mouse, which, normally (AFAIK), can only capture single mouse events. In other words, if you click somewhere (using your finger on the screen) and hold, while moving a second finger around, the screen will not respond to the second finger until the first one is released. I guess this is why the "OnScreen Keyboard" XP application (osk.exe) has an inferior solution, where the Shift key acts like a one-time Caps Lock, capitalizing the next keystroke. I guess this implies that something like Ctrl + Alt + W requires three separate clicks in sequence? :roll:

Please let me know how you solved this! Perhaps I can port this function into my Linux/Java project, if I'm lucky.
Otherwise, maybe you have plans for a Linux version of your excellent keyboard app? 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 11th, 2007, 9:31 am 
Offline

Joined: December 1st, 2006, 9:27 am
Posts: 460
Thanks for the kind words!
I solved the problem by creating a queue (I misspelled this in the code. :oops: )
When you click, for instance, Ctrl, "{Ctrl Down}" gets appended to the "stickyQueOpen" variable and "{Ctrl Up}" gets prepended to the "stickyQueClose" variable.
If you then click Alt, "{Alt down}" is appended to "stickyQueOpen" and "{Alt up}" is prepended to "stickyQueClose".
When you also click a non-modifier key like F1, this is sent:
"{Ctrl down}{Alt down}{F1}{Alt up}{Ctrl up}" and the queue is cleared.

If you click Ctrl or Alt, Etc a second time without clicking a non-modifier, the keys are removed from the Queue.

joakimk wrote:
screen will not respond to the second finger until the first one is released
As far as I know, this is standard with touchscreens.

joakimk wrote:
inferior solution, where the Shift key acts like a one-time Caps Lock, capitalizing the next keystroke. I guess this implies that something like Ctrl + Alt + W requires three separate clicks in sequence?
This is how I do it. Because the mouse itself can only be in one place at a time, there is not a workaround that I am aware of. Standard touchscreens, all the ones I have worked with (only 4), emulate the mouse and behave the same way. If you have a special purpose touchscreen, it may have the capability of reading multiple presses simultaneously. I have no experience with that, though.

[EDIT]
I plan to check to see if it will work in wine. Autohotkey is listed as working in wine, but some of the stuff I need to do for ahkosk may not. I'll have to see. If anyone tries it before me, let me know!
[EDIT]
AhkOsk does not function properly in linux. I ran it under Ubuntu (Feisty) with Wine. The transparent stuff isn't transparent and the virtual key stuff doesn't work. I will revisit this later.

_________________
Image


Last edited by Micahs on February 22nd, 2008, 9:36 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2007, 5:08 pm 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1832
I have just about finished my own onsceen keyboard, very similar to the wiis in appearance (if youve seen that) and I have made buttons in ahk that act like flash, but theres one thing i was hoping you could advise me on without me having to read your entire code..... how did you make the keyboard not steal focus? For example, if I go to rename a file, then when i am in the rename edit box, then i can still click on the keyboard and rename it. Thanks

It looks like to me that you have disabled the onscreen keyboard, and then are setting a timer to check if LButton is down and which control you are over at the time. Is this correct, or is there more to it?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2007, 11:14 pm 
Offline

Joined: December 1st, 2006, 9:27 am
Posts: 460
tic wrote:
or is there more to it?
Yeah, there is. If you only disable the gui, it still steals focus when you click. See the origin thread for other methods that were tried.

The only way to prevent focus-stealing (AFAIK) is to prevent the gui from ever seeing the click. My solution was to remap the left-click button to something else (something that would not cause the gui to grab focus) and then checking the state of that.

I settled on using virtual keys (suggested by ricke, although I have since revised this method to be event-driven and not timer-based - I haven't posted it yet, though. I'm still testing. I am trying to make this compatible with Wine on Linux, if possible.)

By checking the mouse pos to get which control it's over when the virtual key is down, you can detect the clicks. Keep in mind that you have to disable the remap when the mouse is not over the kb gui, and enable it when it is over the gui.

Hopefully this makes sense.


Upcoming Features:
  • More reliable click detection - never miss a click!
  • Multiple keyboards at once
  • Different fonts for each key or row
  • Key label can be different from key function
  • Something else I can't remember
  • Macros

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2007, 7:05 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1832
Ay yes, I see what you mean now, with the *LButton at the bottom. The problem is that mine is a fullscreen keyboard like the wiis, and to open it, you must click on the system tray icon. Would there be a way to open the program from the system tray icon without the system tray stealing focus? so some way to do what you are already doing with *LButton but only when over the sys tray icon, or would it be necessary to make a small gui in the corner say that would open the keyboard?

My keyboard requires WM_MOUSEMOVE (0x200) to give it a flash like appearance. Is this possible with your method, as it would appear it would be if youre just remapping LButton and not disabling the window.

Thanks again Micahs.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2007, 10:16 am 
Offline

Joined: December 1st, 2006, 9:27 am
Posts: 460
Try this. Left-Click on the icon and the gui will appear - without stealing focus.
Code:
;ORIGINAL CODE BY Tasman HERE: http://www.autohotkey.com/forum/viewtopic.php?t=12334
#persistent
leftclick("off")   ;by default disable the leftclick remap
Menu, Tray, Icon, pifmgr.dll, 2 ; set the icon for this script
; the icon to look for (in this case the one of this script)
iconstr = 2 pifmgr.dll ; the number of the icon [space] filename containing the icon
; get the icon sizes (system small) in order to determine the size of the area for the mouseover event
sysget, sm_cxsmicon, 49
sysget, sm_cysmicon, 50
virtualkey = VK07
; MsgBox, %sm_cxsmicon% %sm_cysmicon%
SetTimer, mouseovericon, 250 ; check if the mouse is over the icon
SetTimer, CheckForClick, 25

Gui, Add, Button,, Keyboard
Gui, Add, Button,, Keyboard
Gui, Add, Button,, Keyboard

Return

mouseovericon:
   mouseovericon := iconfind(iconstr,sm_cxsmicon,sm_cysmicon)
   if mouseovericon = 0
   {   leftclick("on")
   }
   Else
   {   leftclick("off")
      If GetKeyState(%virtualkey%)
      {   Send, {%virtualkey% Up}   ;make sure it's up
         debounce=0
      }
   }
Return

iconfind(iconstr,sm_cxsmicon,sm_cysmicon)
; checks to see if the mouse is over the given tray icon
; returns:
; 0 if mouse is over the icon,
; 1 if image not found
; 2 if imagesearch produced an error or
; 3 if icon was found but mouse was not over the image
{
   coordmode, pixel, screen ; set the coords for imagesearch to absolute
   coordmode, mouse, screen ; set mouse coords to absolute
   ; retrieve the tray position and size in order to limit (speedup) the imagesearch
   WinGetPos, trayX, trayY, trayWidth, trayHeight, ahk_class Shell_TrayWnd
   MouseGetPos, mouseX, mouseY ; get the mouse position
   ; see if the icon exists in the traywindow
   ImageSearch, imageX, imageY, trayX, trayY, trayX+trayWidth, trayY+trayHeight, *Icon%iconstr%
   coordmode, pixel, relative ; reset the coords for imagesearch to default
   coordmode, mouse, relative ; reset mouse coords to default
   if ErrorLevel > 0 ; image not found or an image search error occurred
      return %errorlevel%
   imageXlarge := imageX+sm_cxsmicon ; the outerlimit for X
   imageYlarge := ImageY+sm_cysmicon ; the outerlimit for Y
   if mouseX between %imageX% and %imageXlarge%
      if mouseY between %imageY% and %imageYlarge%
         return 0 ; if the mouse is over the designated icon
   return 3 ; 3 means mouse not over the icon
}


CheckForClick:
   GetKeyState, vKey, %virtualkey%
   If (vKey="D") and (debounce=0)
   {   debounce=1
      Gui, Show, NA
   }
Return

;the following are from ahkosk
LeftClick(which)   ;enable or disable left-click hotkey
{   
   If(which="on")
   {   Hotkey, *LButton, On
      Hotkey, *LButton up, On
   }
   Else
   {   Hotkey, *LButton, Off
      Hotkey, *LButton up, Off
   }
}

*LButton::   ;map left click to the Virtual Key - VK does not stand for Voigt-Kampff
   SetKeyDelay -1
   Send {Blind}{%virtualkey% Down}
Return
*LButton up::
   SetKeyDelay -1
   Send {Blind}{%virtualkey% Up}
   debounce=0
Return

Some clever use of the imagesearch function by Tasman and my ZeroFocus technique seem to do the trick. Keep in mind that you'll have to ensure that your icon is visible for this to work.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2007, 10:39 am 
Offline

Joined: December 1st, 2006, 9:27 am
Posts: 460
Or this. Same thing but with added WM_MOUSEMOVE stuff. Crude, I know, but it demonstrates the point: LeftClick remap will not interfere with MouseMove.
Code:
;ORIGINAL CODE BY Tasman HERE: http://www.autohotkey.com/forum/viewtopic.php?t=12334
#persistent
leftclick("off")   ;by default disable the leftclick remap
Menu, Tray, Icon, pifmgr.dll, 2 ; set the icon for this script
; the icon to look for (in this case the one of this script)
iconstr = 2 pifmgr.dll ; the number of the icon [space] filename containing the icon
; get the icon sizes (system small) in order to determine the size of the area for the mouseover event
sysget, sm_cxsmicon, 49
sysget, sm_cysmicon, 50
virtualkey = VK07
debounce=0
; MsgBox, %sm_cxsmicon% %sm_cysmicon%
OnMessage(0x200, "WM_MOUSEMOVE")
OnMessage(0x2A3, "WM_MOUSELEAVE")
SetTimer, mouseovericon, 250 ; check if the mouse is over the icon
SetTimer, CheckForClick, 25

DetectHiddenWindows, On
Gui, Add, Button,, Keyboard
Gui, Add, Button,, Keyboard
Gui, Add, Button,, Keyboard
Gui, +LastFound +AlwaysOnTop
guiID := WinExist()
Return

guiClose:
   ExitApp
Return

mouseovericon:
   mouseovericon := iconfind(iconstr,sm_cxsmicon,sm_cysmicon)
   if mouseovericon = 0
   {   leftclick("on")
   }
   Else
   {   leftclick("off")
      If GetKeyState(%virtualkey%)
      {   Send, {%virtualkey% Up}   ;make sure it's up
         debounce=0
      }
   }
Return

iconfind(iconstr,sm_cxsmicon,sm_cysmicon)
; checks to see if the mouse is over the given tray icon
; returns:
; 0 if mouse is over the icon,
; 1 if image not found
; 2 if imagesearch produced an error or
; 3 if icon was found but mouse was not over the image
{
   coordmode, pixel, screen ; set the coords for imagesearch to absolute
   coordmode, mouse, screen ; set mouse coords to absolute
   ; retrieve the tray position and size in order to limit (speedup) the imagesearch
   WinGetPos, trayX, trayY, trayWidth, trayHeight, ahk_class Shell_TrayWnd
   MouseGetPos, mouseX, mouseY ; get the mouse position
   ; see if the icon exists in the traywindow
   ImageSearch, imageX, imageY, trayX, trayY, trayX+trayWidth, trayY+trayHeight, *Icon%iconstr%
   coordmode, pixel, relative ; reset the coords for imagesearch to default
   coordmode, mouse, relative ; reset mouse coords to default
   if ErrorLevel > 0 ; image not found or an image search error occurred
      return %errorlevel%
   imageXlarge := imageX+sm_cxsmicon ; the outerlimit for X
   imageYlarge := ImageY+sm_cysmicon ; the outerlimit for Y
   if mouseX between %imageX% and %imageXlarge%
      if mouseY between %imageY% and %imageYlarge%
         return 0 ; if the mouse is over the designated icon
   return 3 ; 3 means mouse not over the icon
}

WM_MOUSEMOVE()
{   
   global currButt, guiID
   MouseGetPos,,,gID,kID
   If(gID != guiID)
   {   Return
   }
   currButt := kID
   GuiControl,,%currButt%,in
   
tooltip,%currButt%

}

WM_MOUSELEAVE()
{   
   global currButt
   GuiControl,,%currButt%,out
}

CheckForClick:
   GetKeyState, vKey, %virtualkey%
   If (vKey="D") and (debounce=0)
   {   debounce=1
      Gui, Show, NA
   }
Return

;the following are from ahkosk
LeftClick(which)   ;enable or disable left-click hotkey
{   
   If(which="on")
   {   Hotkey, *LButton, On
      Hotkey, *LButton up, On
   }
   Else
   {   Hotkey, *LButton, Off
      Hotkey, *LButton up, Off
   }
}

*LButton::   ;map left click to the Virtual Key - VK does not stand for Voigt-Kampff
   SetKeyDelay -1
   Send {Blind}{%virtualkey% Down}
Return
*LButton up::
   SetKeyDelay -1
   Send {Blind}{%virtualkey% Up}
   debounce=0
Return

_________________
Image


Last edited by Micahs on November 9th, 2007, 6:37 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2007, 10:50 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1832
thanks micahs. i realise now that i may not be able to use the method to stop it stealing focus as i have an edit box at the top of my gui that needs to let the user select text etc. unless you can also think of a way to do that.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2007, 5:46 pm 
Online
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8657
Location: Salem, MA
Micahs wrote:
  • Something else I can't remember


I hope that makes the Changelog :D

The other comment thing I like to do is
Code:
;The next line is an awful, horrible hack!
(some code that is really bad, but works)   ;This is a horrible horrible hack!
;The previous line was a really bad hack that makes (n) work.


Though I usually use CAPS for it...
:)

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 159 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], nothing, toddintr and 20 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