Bind mouse click to launch Windows On-Screen Keyboard with parameters

Get help with using AutoHotkey and its commands and hotkeys
User avatar
NuclearBinoculars
Posts: 2
Joined: 17 May 2019, 15:44
GitHub: NuclearBinoculars

Bind mouse click to launch Windows On-Screen Keyboard with parameters

17 May 2019, 16:10

Hi guys!
I wish to bind a mouse click to launch Windows On-Screen Keyboard, but with parameters.

Here are the specific requirements :

1. Bound mouse button will launch OSK if it's not already launched.

2. If OSK is already launched, bound button will either minimize OSK (if OSK is active window in foreground), or restore OSK to foreground (if OSK is minimized/not active window).

I know how to bind mouse buttons to launch OSK, but I don't know how to script the parameters from requirement #2.


Thanks guys - Any help will be appreciated!
User avatar
YoucefHam
Posts: 255
Joined: 24 Aug 2015, 12:56
Facebook: YoucefHamDz

Re: Bind mouse click to launch Windows On-Screen Keyboard with parameters

18 May 2019, 04:48

here try this

Code: Select all

XButton2::
Process, Exist, osk.exe
if !ErrorLevel
	Run, osk.exe
IfWinExist, ahk_exe osk.exe
	WinHide,  ahk_exe osk.exe
else
	WinShow,  ahk_exe osk.exe
return
:wave: There is always more than one way to solve a problem. ;)
User avatar
NuclearBinoculars
Posts: 2
Joined: 17 May 2019, 15:44
GitHub: NuclearBinoculars

Re: Bind mouse click to launch Windows On-Screen Keyboard with parameters

Yesterday, 22:41

Hi Ham. Sorry for getting back to you so late, I was busy with life stuffs.

I tried your script. It launches OSK but does not minimize or affect it when already launched.

I have also tried using IfWinExist, WinActivate, IfWinNotExist, AHK_class, Process, Winhide/Winshow, etc etc etc.

I have not gotten any script to minimize or swap the active On-Screen Keyboard.


At that point I went ahead and installed Click-N-Type. It DOES have a nice feature that auto-hides the KB with a fast timeout.


If anyone else has tips for a script that works with OSK, please let me know - otherwise I will just keep using Click-N-Type.


Thanks guys!

Return to “Ask For Help”

Who is online

Users browsing this forum: AviationGuy, Odlanir and 211 guests