Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Pressed keys by Michał Durak (micechal) based on Jon's On-Screen keyboard.
- ;
- ;Changelog:
- ;v1.1 - 30.12.12
- ; * Better buttons placement
- ; * Narrower spacebar button
- ; + Added the left and right mouse buttons
- ; * Closing the Arrows window doesn't kill script
- ; * Closing windows changes positions in the Tray menu
- ; - Abandoned the 'Clicking' version because of AutoHotkey limits
- ;v1.0 - 28.12.12
- ; + Initial release
- ;---- Configuration Section: Customize the size of the on-screen keyboard and
- ; other options here.
- ; Changing this font size will make the entire on-screen keyboard get
- ; larger or smaller:
- k_FontSize = 10
- k_FontName = Verdana ; This can be blank to use the system's default font.
- k_FontStyle = Bold ; Example of an alternative: Italic Underline
- ; Names for the tray menu items:
- k_MenuItemHideArrows = Hide arrow keys
- k_MenuItemShowArrows = Show arrow keys
- k_MenuItemHideShift = Hide shift
- k_MenuItemShowShift = Show shift
- k_MenuItemHideSpacebar = Hide spacebar
- k_MenuItemShowSpacebar = Show spacebar
- k_MenuItemHideAll = Hide all
- k_MenuItemShowAll = Show all
- k_MenuItemHideMouse = Hide mouse
- k_MenuItemShowMouse = Show mouse
- ; Background color (default is green (00FF00) for Chroma Keying in OBS)
- Background_color = 00FF00
- ; How do you want to see pressed keys:
- ; Show/Hide will hide all buttons at start and then make them visible when keys are pressed on keyboard
- ; Enable/Disable will gray out all buttons at start and then make them normal when keys are pressed on keyboard
- EnableAndDisable = n ;Only two options here, y - yes (will use Enable/Disable), anything else - will use Show/Hide
- ;---- End of configuration section. Don't change anything below this point
- ; unless you want to alter the basic nature of the script.
- if EnableAndDisable = y
- {
- ShowOrEnable = Enable
- HideOrDisable = Disable
- }
- else
- {
- ShowOrEnable = Show
- HideOrDisable = Hide
- }
- ;---- Alter the tray icon menu:
- Menu, Tray, Add, %k_MenuItemShowAll%, k_ShowAll
- Menu, Tray, Add, %k_MenuItemHideAll%, k_HideAll
- Menu, Tray, Add, %k_MenuItemHideArrows%, k_ShowHideArrows
- Menu, Tray, Add, %k_MenuItemHideShift%, k_ShowHideShift
- Menu, Tray, Add, %k_MenuItemHideSpacebar%, k_ShowHideSpacebar
- Menu, Tray, Add, %k_MenuItemHideMouse%, k_ShowHideMouse
- Menu, Tray, Add, &Exit, k_MenuExit
- Menu, Tray, NoStandard
- ;---- Calculate object dimensions based on chosen font size:
- k_KeyWidth = %k_FontSize%
- k_KeyWidth *= 3
- k_KeyHeight = %k_FontSize%
- k_KeyHeight *= 3
- k_KeyMargin = %k_FontSize%
- k_KeyMargin /= 6
- k_SpacebarWidth = %k_FontSize%
- k_SpacebarWidth *= 18
- k_KeyWidthHalf = %k_KeyWidth%
- k_KeyWidthHalf /= 2
- k_KeySize = w%k_KeyWidth% h%k_KeyHeight%
- k_Position = x+%k_KeyMargin% %k_KeySize%
- ;---- Create a GUI window for the on-screen keyboard:
- Gui, +ToolWindow
- Gui, 2:+ToolWindow
- Gui, 3:+ToolWindow
- Gui, 4:+ToolWindow
- Gui, Font, s%k_FontSize% %k_FontStyle%, %k_FontName%
- Gui, 2:Font, s%k_FontSize% %k_FontStyle%, %k_FontName%
- Gui, 3:Font, s%k_FontSize% %k_FontStyle%, %k_FontName%
- Gui, 4:Font, s%k_FontSize% %k_FontStyle%, %k_FontName%
- Gui, Color, %Background_color%
- Gui, 2:Color, %Background_color%
- Gui, 3:Color, %Background_color%
- Gui, 4:Color, %Background_color%
- ;---- Add a button for each key. Position the first button with absolute
- ; coordinates so that all other buttons can be positioned relative to it:
- ;ARROWS
- Gui, Add, Button, xm+%k_KeyWidth%, ↑
- Gui, Add, Button, xm y+%k_KeyMargin% h%k_KeyHeight%, ← ; Auto-width.
- Gui, Add, Button, %k_Position%, ↓
- Gui, Add, Button, %k_Position%, →
- ;SHIFT
- Gui, 2:Add, Button,, Shift%A_Space%%A_Space%
- ;SPACEBAR
- Gui, 3:Add, Button, w%k_SpacebarWidth%, Space
- ;MOUSE
- Gui, 4:Add, Button,, LMB
- Gui, 4:Add, Button,, RMB
- ;---- Show the window:
- Gui, Show, , Arrows
- Control, %HideOrDisable%, , ↑, Arrows
- Control, %HideOrDisable%, , ←, Arrows
- Control, %HideOrDisable%, , ↓, Arrows
- Control, %HideOrDisable%, , →, Arrows
- Gui, 2:Show, , Shift
- Control, %HideOrDisable%, , Shift, Shift
- Gui, 3:Show, , Spacebar
- Control, %HideOrDisable%, , Space, Spacebar
- Gui, 4:Show, , Mouse
- Control, %HideOrDisable%, , LMB, Mouse
- Control, %HideOrDisable%, , RMB, Mouse
- k_IsVisibleAll = y
- k_IsVisibleArrows = y
- k_IsVisibleShift = y
- k_IsVisibleSpacebar = y
- k_IsVisibleMouse = y
- ;---- When a key is pressed by the user, click the corresponding button on-screen:
- ;ARROWS
- ~*Up::
- Control, %ShowOrEnable%, , ↑, Arrows
- KeyWait, Up
- Control, %HideOrDisable%, , ↑, Arrows
- return
- ~*Down::
- Control, %ShowOrEnable%, , ↓, Arrows
- KeyWait, Down
- Control, %HideOrDisable%, , ↓, Arrows
- return
- ~*Left::
- Control, %ShowOrEnable%, , ←, Arrows
- KeyWait, Left
- Control, %HideOrDisable%, , ←, Arrows
- return
- ~*Right::
- Control, %ShowOrEnable%, , →, Arrows
- KeyWait, Right
- Control, %HideOrDisable%, , →, Arrows
- return
- ;SHIFT
- ~*Shift::
- Control, %ShowOrEnable%, , Shift, Shift
- KeyWait, Shift
- Control, %HideOrDisable%, , Shift, Shift
- return
- ;SPACEBAR
- ~*Space::
- Control, %ShowOrEnable%, , Space, Spacebar
- KeyWait, Space
- Control, %HideOrDisable%, , Space, Spacebar
- return
- ;MOUSE
- ~*LButton::
- Control, %ShowOrEnable%, , LMB, Mouse
- KeyWait, LButton
- Control, %HideOrDisable%, , LMB, Mouse
- return
- ~*RButton::
- Control, %ShowOrEnable%, , RMB, Mouse
- KeyWait, RButton
- Control, %HideOrDisable%, , RMB, Mouse
- return
- ; ---- Tray Menu ----
- ;HIDE ALL
- k_HideAll:
- Gui, Cancel
- Gui, 2:Cancel
- Gui, 3:Cancel
- Gui, 4:Cancel
- if k_IsVisibleArrows = y
- {
- Menu, Tray, Rename, %k_MenuItemHideArrows%, %k_MenuItemShowArrows%
- k_IsVisibleArrows = n
- }
- if k_IsVisibleShift = y
- {
- Menu, Tray, Rename, %k_MenuItemHideShift%, %k_MenuItemShowShift%
- k_IsVisibleShift = n
- }
- if k_IsVisibleSpacebar = y
- {
- Menu, Tray, Rename, %k_MenuItemHideSpacebar%, %k_MenuItemShowSpacebar%
- k_IsVisibleSpacebar = n
- }
- if k_IsVisibleMouse = y
- {
- Menu, Tray, Rename, %k_MenuItemHideMouse%, %k_MenuItemShowMouse%
- k_IsVisibleMouse = n
- }
- k_IsVisibleAll = n
- return
- ;SHOW ALL
- k_ShowAll:
- if k_IsVisibleAll = n
- {
- if k_IsVisibleArrows = n
- {
- Gui, Show
- Menu, Tray, Rename, %k_MenuItemShowArrows%, %k_MenuItemHideArrows%
- k_IsVisibleArrows = y
- }
- if k_IsVisibleShift = n
- {
- Menu, Tray, Rename, %k_MenuItemShowShift%, %k_MenuItemHideShift%
- k_IsVisibleShift = y
- Gui, 2:Show
- }
- if k_IsVisibleSpacebar = n
- {
- Menu, Tray, Rename, %k_MenuItemShowSpacebar%, %k_MenuItemHideSpacebar%
- k_IsVisibleSpacebar = y
- Gui, 3:Show
- }
- if k_IsVisibleMouse = n
- {
- Menu, Tray, Rename, %k_MenuItemShowMouse%, %k_MenuItemHideMouse%
- k_IsVisibleMouse = y
- Gui, 4:Show
- }
- k_IsVisibleAll = y
- }
- return
- ;ARROWS
- k_ShowHideArrows:
- if k_IsVisibleArrows = y
- {
- Gui, Cancel
- Menu, Tray, Rename, %k_MenuItemHideArrows%, %k_MenuItemShowArrows%
- k_IsVisibleArrows = n
- k_IsVisibleAll = n
- }
- else
- {
- Gui, Show
- Menu, Tray, Rename, %k_MenuItemShowArrows%, %k_MenuItemHideArrows%
- k_IsVisibleArrows = y
- }
- return
- ;SHIFT
- k_ShowHideShift:
- if k_IsVisibleShift = y
- {
- Gui, 2:Cancel
- Menu, Tray, Rename, %k_MenuItemHideShift%, %k_MenuItemShowShift%
- k_IsVisibleShift = n
- k_IsVisibleAll = n
- }
- else
- {
- Gui, 2:Show
- Menu, Tray, Rename, %k_MenuItemShowShift%, %k_MenuItemHideShift%
- k_IsVisibleShift = y
- }
- return
- ;SPACEBAR
- k_ShowHideSpacebar:
- if k_IsVisibleSpacebar = y
- {
- Gui, 3:Cancel
- Menu, Tray, Rename, %k_MenuItemHideSpacebar%, %k_MenuItemShowSpacebar%
- k_IsVisibleSpacebar = n
- k_IsVisibleAll = n
- }
- else
- {
- Gui, 3:Show
- Menu, Tray, Rename, %k_MenuItemShowSpacebar%, %k_MenuItemHideSpacebar%
- k_IsVisibleSpacebar = y
- }
- return
- ;MOUSE
- k_ShowHideMouse:
- if k_IsVisibleMouse = y
- {
- Gui, 4:Cancel
- Menu, Tray, Rename, %k_MenuItemHideMouse%, %k_MenuItemShowMouse%
- k_IsVisibleMouse = n
- k_IsVisibleAll = n
- }
- else
- {
- Gui, 4:Show
- Menu, Tray, Rename, %k_MenuItemShowMouse%, %k_MenuItemHideMouse%
- k_IsVisibleMouse = y
- }
- return
- GuiClose:
- Gui, Cancel
- Menu, Tray, Rename, %k_MenuItemHideArrows%, %k_MenuItemShowArrows%
- k_IsVisibleArrows = n
- k_IsVisibleAll = n
- return
- 2GuiClose:
- Gui, 2:Cancel
- Menu, Tray, Rename, %k_MenuItemHideShift%, %k_MenuItemShowShift%
- k_IsVisibleShift = n
- k_IsVisibleAll = n
- return
- 3GuiClose:
- Gui, 3:Cancel
- Menu, Tray, Rename, %k_MenuItemHideSpacebar%, %k_MenuItemShowSpacebar%
- k_IsVisibleSpacebar = n
- k_IsVisibleAll = n
- return
- 4GuiClose:
- Gui, 4:Cancel
- Menu, Tray, Rename, %k_MenuItemHideMouse%, %k_MenuItemShowMouse%
- k_IsVisibleMouse = n
- k_IsVisibleAll = n
- return
- k_MenuExit:
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement