Oh my! This is a surprise, I just finished working on a solution to release not a month ago! Didn't ever occur to me that someone else might have got there before me (or in this case WAAAAAAY before me). Kudos jonny!
I will post my version below as, if nothing else, it's certainly written differently, whether or not the functionality is different I don't know! For easy reference, let's just say it's *ahem* VERY heavily based off this solution
http://half-qwerty.com/, see the
demo flash software for exact functionality guide as it mimics this exactly, including flipping punctuation when the shift key is used to toggle this.
Code:
#SingleInstance force
#InstallKeybdHook
#Persistent ; Keep the script running until the user exits it.
Menu, tray, NoStandard
Menu, tray, add, &Reload, MenuReload
Menu, tray, add, &Suspend, MenuSuspend ;Needs to be a toggle!!!!!!
Menu, tray, add
Menu, tray, add, &Diagnostics, MenuDiagnostics
Menu, tray, add ; Creates a separator line.
Menu, tray, add, &Exit, MenuExit ; Creates a new menu item.
;Syntax: ToasterPopup(["Title"],["Message"],["Title Font Color"],["Title Font Size"],["Font Color"],["Font Size"],["Background Color"],[Lifetime in MS (0 to persist until clicked)]
ToasterPopup("Loading Succesful", "Half-Qwerty loaded succesfully", "Blue", "12", "Black", "10", "White", 2000)
Return
;;;;;;;;;;;; End of auto-execute section ;;;;;;;;;;;;
MenuReload:
Reload
Return
MenuSuspend:
Suspend, Toggle
If A_IsSuspended = 1
{
menu, tray, Check, &Suspend
}
Else
{
menu, tray, Uncheck, &Suspend
}
Return
MenuDiagnostics:
KeyHistory
Return
MenuExit:
ExitApp
Return
Space::
Send {Space}
Return
!Space::
Send !{Space}
Return
^Space::
Send ^{Space}
Return
Shift::
Send {Blind}{Capslock}
Return
/*
When {Blind} is the first item in the string, the program avoids releasing Alt/Control/Shift/Win if they started out in the down position. For example, the hotkey +s::Send {Blind}abc would send ABC rather than abc because the user is holding down the Shift key. {Blind} also causes SetStoreCapslockMode to be ignored; that is, the state of Capslock is not changed.
*/
Space & SC029::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send ¬
}
Else
{
Send -
}
Return
Space & 1::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send )
}
Else
{
Send 0
}
Return
Space & 2::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send (
}
Else
{
Send 9
}
Return
Space & 3::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send *
}
Else
{
Send 8
}
Return
Space & 4::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send &
}
Else
{
Send 7
}
Return
Space & 5::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send {^}
}
Else
{
Send 6
}
Return
Space & 6::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send `%
}
Else
{
Send 5
}
Return
Space & 7::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send {$}
}
Else
{
Send 4
}
Return
Space & 8::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send £
}
Else
{
Send 3
}
Return
Space & 9::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send {"}
}
Else
{
Send 2
}
Return
Space & 0::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send {!}
}
Else
{
Send 1
}
Return
Space & -::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send {_}
}
Else
{
Send ``
}
Return
Space & Tab::
Send {Backspace}
Return
Space & q::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send P
}
Else
{
Send p
}
Return
Space & w::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send O
}
Else
{
Send o
}
Return
Space & e::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send I
}
Else
{
Send i
}
Return
Space & r::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send U
}
Else
{
Send u
}
Return
Space & t::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send Y
}
Else
{
Send y
}
Return
Space & y::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send T
}
Else
{
Send t
}
Return
Space & u::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send R
}
Else
{
Send r
}
Return
Space & i::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send E
}
Else
{
Send e
}
Return
Space & o::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send W
}
Else
{
Send w
}
Return
Space & p::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send Q
}
Else
{
Send q
}
Return
Space & [::
Send {Tab}
Return
Space & ]::
Send {Tab}
Return
/*
Space & \:: ; Correct for UK keyboard?
Send {Tab}
Return
*/
Space & Capslock::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send @
}
Else
{
Send '
}
Return
Space & a::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send {:}
}
Else
{
Send {;}
}
Return
Space & s::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send L
}
Else
{
Send l
}
Return
Space & d::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send K
}
Else
{
Send k
}
Return
Space & f::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send J
}
Else
{
Send j
}
Return
Space & g::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send H
}
Else
{
Send h
}
Return
Space & h::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send G
}
Else
{
Send g
}
Return
Space & j::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send F
}
Else
{
Send f
}
Return
Space & k::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send D
}
Else
{
Send d
}
Return
Space & l::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send S
}
Else
{
Send s
}
Return
Space & `;::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send A
}
Else
{
Send a
}
Return
Space & z::
Send /
Return
Space & x::
Send .
Return
Space & c::
Send `,
Return
Space & v::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send M
}
Else
{
Send m
}
Return
Space & b::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send N
}
Else
{
Send n
}
Return
Space & n::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send B
}
Else
{
Send b
}
Return
Space & m::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send V
}
Else
{
Send v
}
Return
Space & ,::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send C
}
Else
{
Send c
}
Return
Space & .::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send X
}
Else
{
Send x
}
Return
Space & /::
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
If state := GetKeyState("Capslock", "T") ; True if CapsLock is ON, false otherwise.
{
Send Z
}
Else
{
Send z
}
Return
ToasterPopup(TP_Title, TP_Message, TP_TitleFontColor, TP_TitleFontSize, TP_FontColor, TP_FontSize, TP_BGColor, TP_Lifespan)
{
DetectHiddenWindows, On
SysGet, Workspace, MonitorWorkArea
Gui, 89:-Caption +ToolWindow +LastFound +AlwaysOnTop +Border
Gui, 89:Color, %TP_BGColor%
Gui, 89:Font, s%TP_TitleFontSize% c%TP_TitleFontColor%
Gui, 89:Add, Text, gTP_Fade, %TP_Title%
Gui, 89:Font, s%TP_FontSize% c%TP_FontColor%
Gui, 89:Add, Text, gTP_Fade xs y30, %TP_Message%
Gui, 89:Show, Hide
Global GUI_ID ;Is this the proper way to use Global? I need it for TP_Fade...
GUI_ID := WinExist()
WinGetPos, GUIX, GUIY, GUIWidth, GUIHeight, ahk_id %GUI_ID%
NewX := WorkSpaceRight-GUIWidth-5
NewY := WorkspaceBottom-GUIHeight-5
Gui, 89:Show, Hide x%NewX% y%NewY%
DllCall("AnimateWindow","UInt",GUI_ID,"Int",500,"UInt","0x00040008") ; TOAST!
If (TP_Lifespan=0)
Return
Else
{
Sleep, %TP_Lifespan%
GoSub, TP_Fade
Return
}
TP_Fade:
DllCall("AnimateWindow","UInt",GUI_ID,"Int",1000,"UInt","0x90000") ; Fade out when clicked
Return
}
Note: The above code includes a slightly modified (purely for cosmetic purposes) version of Rhys et al's
Toaster Popup function.
Please note: If you have any problems with my code, or if I've 'borrowed' code and forgotten to credit you (Sorry in advance, I'm really bad at that!), or want to talk about any part of the script or possible modifications, just PM or e-mail me
