AutoHotkey Community

It is currently May 26th, 2012, 11:13 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 164 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next
Author Message
PostPosted: October 28th, 2008, 2:27 pm 
I feel kinda lonely on this thread.
My modest line is too modest to work, and is even redundant. Cool start.

aCkRiTe has dug up and pointed this script, thank you aCkRiTe and thank you for the author

Code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Capitalize letters after 1 second hold
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#SingleInstance Force
#Persistent
#NoEnv
SendMode, Input
SetBatchLines, -1

KeyIsDown = 0
UpperDelay = 1000
UpperDelay *= -1
Return

KeyDown(key)
   {
        Global KeyIsDown
        Global LastKey
        If (KeyIsDown < 1 or Key <> LastKey)
           {
                KeyIsDown := True
                LastKey := Key
                Send %Key%
                SetKeyDelay, 65535
                SetTimer, ReplaceWithUpper, %UpperDelay%
           }
        Return
   }

KeyUp(Key)
   {
        Global KeyIsDown
        Global LastKey
        SetTimer, ReplaceWithUpper, Off
        KeyIsDown := False
        Return
   }

ReplaceWithUpper:
SetKeyDelay, -1
Send {Backspace}+%LastKey%
Return

a:: KeyDown("a")
b:: KeyDown("b")
c:: KeyDown("c")
d:: KeyDown("d")
e:: KeyDown("e")
f:: KeyDown("f")
g:: KeyDown("g")
h:: KeyDown("h")
i:: KeyDown("i")
j:: KeyDown("j")
k:: KeyDown("k")
l:: KeyDown("l")
m:: KeyDown("m")
n:: KeyDown("n")
o:: KeyDown("o")
p:: KeyDown("p")
q:: KeyDown("q")
r:: KeyDown("r")
s:: KeyDown("s")
t:: KeyDown("t")
u:: KeyDown("u")
v:: KeyDown("v")
w:: KeyDown("w")
x:: KeyDown("x")
y:: KeyDown("y")
z:: KeyDown("z")

a Up:: KeyUp("a")
b Up:: KeyUp("b")
c Up:: KeyUp("c")
d Up:: KeyUp("d")
e Up:: KeyUp("e")
f Up:: KeyUp("f")
g Up:: KeyUp("g")
h Up:: KeyUp("h")
i Up:: KeyUp("i")
j Up:: KeyUp("j")
k Up:: KeyUp("k")
l Up:: KeyUp("l")
m Up:: KeyUp("m")
n Up:: KeyUp("n")
o Up:: KeyUp("o")
p Up:: KeyUp("p")
q Up:: KeyUp("q")
r Up:: KeyUp("r")
s Up:: KeyUp("s")
t Up:: KeyUp("t")
u Up:: KeyUp("u")
v Up:: KeyUp("v")
w Up:: KeyUp("w")
x Up:: KeyUp("x")
y Up:: KeyUp("y")
z Up:: KeyUp("z")



But I'm at a loss to make it compatible with Markus script.
Any idea please?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 1:56 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Note about AutoHotkey_L Unicode version: If you are running the AutoHotkey_L Unicode version be sure to save the script in Unicode encoding as well, otherwise you will get an error:
Error at line 64. Line Text: '
Error: The leftmost character above is illegal in an expression.


Edit3a - 2011-02-21
- Added URLDownloadToFile for missing icon and keyboard layout images downloaded from www.autohotkey.net if not found in %A_ScriptDir%
- Added menu option to show keyboard layout in an AlwaysOnTop Gui (via Tray)

Code:
#SingleInstance, force
; Half-QWERTY: One-handed Typing - version 3a
; http://www.autohotkey.com/forum/viewtopic.php?p=228783#228783
;
; HalfKeyboard invented by Matias Corporation between 1992 and 1996
; Originally coded in AutoHotkey by jonny in 2004
; Many thanks to Chris for helping him out with this script.
; Capslock hacks and `~ remap to '" by Watcher
; This implementation was done by mbirth in 2007
;
; version 3a script, mod by hugov:
; 2008-10-31:
; - mixed with "Capitalize letters after 1 second hold" at request of Calibran
;   http://www.autohotkey.com/forum/post-228311.html#228311
;   just tested very briefly so try at your own peril :-)
;
; 2011-02-21
; - Added URLDownloadToFile for missing icon and keyboard layout
;   images downloaded from www.autohotkey.net if not found in %A_ScriptDir%
; - Added menu option to show keyboard layout in an AlwaysOnTop Gui (via Tray)

; 2011-02-21
IfNotExist, %A_ScriptDir%\halfkeyboard.ico
   iICO=0
IfNotExist, %A_ScriptDir%\halfkeyboard_help.gif
   iHELP=0
If (iICO=0) or (iHELP=0)
   {
    MsgBox 4, Some Graphics files are missing, do you wish to download them from www.autohotkey.net?
    IfMsgBox, Yes
      {
       URLDownloadToFile, http://www.autohotkey.net/~hugov/halfqwertyfiles/halfkeyboard.ico, %A_ScriptDir%\halfkeyboard.ico ; for tray
       URLDownloadToFile, http://www.autohotkey.net/~hugov/halfqwertyfiles/halfkeyboard_help.gif, %A_ScriptDir%\halfkeyboard_help.gif ; for 5 sec help at caret pos, transparent GIF
       URLDownloadToFile, http://www.autohotkey.net/~hugov/halfqwertyfiles/halfkeyboard_help.png, %A_ScriptDir%\halfkeyboard_help.png ; for permanent gui transparent PNG
      }
   }
; /2011-02-21   
   
KeyIsDown = 0
UpperDelay = 1000
UpperDelay *= -1

IfExist, %A_ScriptDir%\halfkeyboard.ico ; mod 2011-02-21
   {
    Menu Tray, Icon, %A_ScriptDir%\HalfKeyboard.ico
    Menu Tray, Tip, HalfKeyboard emulator
    Menu Tray, Add, &Show Keyboard layout, MenuShowKeyboardLayout
    Menu Tray, Add, E&xit, MenuExit
    Menu Tray, NoStandard
   }


RegRead KLang, HKEY_CURRENT_USER, Keyboard Layout\Preload, 1
StringRight KLang, KLang, 4
If (!KLang)
  KLang := A_Language

If (KLang = "0407") {
  ; 0407 DE_de QWERTZ mirror set
  original := "^12345qwertasdfgyxcvb"
  mirrored := "ß09876poiuzölkjh-.,mn"
} Else If (KLang = "040c" || KLang = "040C") {
  ; 040c FR_fr AZERTY mirror set         
  original := "²&é" . """" . "'(azertqsdfgwxcvb"   ; split up string for better
  mirrored := ")àç" . "_"  . "è-poiuymlkjh!:;,n"   ; human readability
} Else {
  ; 0409 US_us QWERTY mirror set
  original := "``" . "12345qwertasdfgzxcvb"   ; split up string for better
  mirrored := "'"  . "09876poiuy;lkjh/.,mn"   ; human readability
}


; Now define all hotkeys
Loop % StrLen(original)
{
  c1 := SubStr(original, A_Index, 1)
  c2 := SubStr(mirrored, A_Index, 1)
  Hotkey Space & %c1%, DoHotkey
  Hotkey Space & %c2%, DoHotkey
  Hotkey %c1%, KeyDown
  Hotkey %c1% UP, KeyUP
  Hotkey %c2%, KeyDown ; see post by guest below seems to improve the script haven't tried this myself so comment these two lines if it doesn't work
  Hotkey %c2% UP, KeyUP ;
}

return


; This key may help, as the space-on-up may get annoying, especially if you type fast.
Control & Space::Suspend

; Not exactly mirror but as close as we can get, Capslock enter, Tab backspace.
Space & CapsLock::Send {Enter}
Space & Tab::Send {Backspace}

; If spacebar didn't modify anything, send a real space keystroke upon release.
+Space::Send {Space}
Space::Send {Space}

; Define special key combos here (took them from RG's mod):
^1::Send {Home}
^2::Send {End}
^3::Send {Del}

; General purpose
DoHotkey:
  StartTime := A_TickCount
  StringRight ThisKey, A_ThisHotkey, 1
  i1 := InStr(original, ThisKey)
  i2 := InStr(mirrored, ThisKey)
  If (i1+i2 = 0) {
    MirrorKey := ThisKey
  } Else If (i1 > 0) {
    MirrorKey := SubStr(mirrored, i1, 1)
  } Else {
    MirrorKey := SubStr(original, i2, 1)
  }
 
  Modifiers := ""
  If (GetKeyState("LWin") || GetKeyState("RWin")) {
    Modifiers .= "#"
  }
  If (GetKeyState("Control")) {
    Modifiers .= "^"
  }
  If (GetKeyState("Alt")) {
    Modifiers .= "!"
  }
  If (GetKeyState("Shift") + GetKeyState("CapsLock", "T") = 1) {
    ; only add if Shift is held OR CapsLock is on (XOR) (both held down would result in value of 2)
    Modifiers .= "+"
  }

/*
  KeyWait, %ThisKey%, T1
  Send %Modifiers%{%MirrorKey%}
  If (A_TickCount - StartTime >= 1000)
     {
        StringUpper, MirrorKey, MirrorKey
   Send {Backspace}+%MirrorKey%
*/

If (KeyIsDown < 1 or ThisKey <> LastKey)
          {
               KeyIsDown := True
               LastKey := ThisKey
               Send %Modifiers%{%MirrorKey%}
               SetKeyDelay, 65535
               SetTimer, ReplaceWithUpperMirror, %UpperDelay%
          }

Return

Space & F1::
  ; Help-screen using SplashImage
  CoordMode Caret, Screen
  y := A_CaretY + 20
  If (y > A_ScreenHeight-100)
    y := A_CaretY - 20 - 100
  IfExist, %A_ScriptDir%\HalfKeyboard_help.gif ; 2011-02-21 for safety
     {
     SplashImage %A_ScriptDir%\HalfKeyboard_help.gif, B X%A_CaretX% Y%y%
     Sleep 5000
     SplashImage Off
   } 
return

MenuShowKeyboardLayout: ; 2011-02-21
IfWinNotExist, HalfKeyboard - permanent keyboard layout
   {
     Gui, +Owner +Toolwindow +AlwaysOnTop
    Gui, Add, picture, x0 y0 w310 h104, %A_ScriptDir%\halfkeyboard_help.png
    Gui, Show, w310 h104 NA, HalfKeyboard - permanent keyboard layout
    Menu, Tray, Check, &Show Keyboard layout
   }
Else
   {
    Gosub, GuiClose   
   }
Return

GuiClose:
Menu, Tray, UnCheck, &Show Keyboard layout
Gui, Destroy
Return


MenuExit:
  ExitApp
Return

KeyDown:
   Key:=A_ThisHotkey
        If (KeyIsDown < 1 or Key <> LastKey)
           {
                KeyIsDown := True
                LastKey := Key
                Send %Key%
                SetKeyDelay, 65535
                SetTimer, ReplaceWithUpper, %UpperDelay%
           }
        Return

KeyUp:
   Key:=A_ThisHotkey
        SetTimer, ReplaceWithUpper, Off
        SetTimer, ReplaceWithUpperMirror, Off
        KeyIsDown := False
        Return

ReplaceWithUpper:
SetKeyDelay, -1
Send {Backspace}+%LastKey%
Return

ReplaceWithUpperMirror:
SetKeyDelay, -1
Send {Backspace}+%MirrorKey%
Return


Script below is the same as above apart from the built-in checks for the images and downloading...

Edit3 - yet another attempt
Code:
#SingleInstance

; HalfKeyboard invented by Matias Corporation between 1992 and 1996
; Originally coded in AutoHotkey by jonny in 2004
; Many thanks to Chris for helping him out with this script.
; Capslock hacks and `~ remap to '" by Watcher
; This implementation was done by mbirth in 2007
;
; mixed with "Capitalize letters after 1 second hold" at request of Calibran
; http://www.autohotkey.com/forum/post-228311.html#228311
; just tested very briefly so try at your own peril :-)

KeyIsDown = 0
UpperDelay = 1000
UpperDelay *= -1

Menu Tray, Icon, HalfKeyboard.ico
Menu Tray, Tip, HalfKeyboard emulator
Menu Tray, Add, E&xit, MenuExit
Menu Tray, NoStandard
FileInstall HK_dn.gif, HalfKeyboard_help.gif

RegRead KLang, HKEY_CURRENT_USER, Keyboard Layout\Preload, 1
StringRight KLang, KLang, 4
If (!KLang)
  KLang := A_Language

If (KLang = "0407") {
  ; 0407 DE_de QWERTZ mirror set
  original := "^12345qwertasdfgyxcvb"
  mirrored := "ß09876poiuzölkjh-.,mn"
} Else If (KLang = "040c" || KLang = "040C") {
  ; 040c FR_fr AZERTY mirror set         
  original := "²&é" . """" . "'(azertqsdfgwxcvb"   ; split up string for better
  mirrored := ")àç" . "_"  . "è-poiuymlkjh!:;,n"   ; human readability
} Else {
  ; 0409 US_us QWERTY mirror set
  original := "``" . "12345qwertasdfgzxcvb"   ; split up string for better
  mirrored := "'"  . "09876poiuy;lkjh/.,mn"   ; human readability
}


; Now define all hotkeys
Loop % StrLen(original)
{
  c1 := SubStr(original, A_Index, 1)
  c2 := SubStr(mirrored, A_Index, 1)
  Hotkey Space & %c1%, DoHotkey
  Hotkey Space & %c2%, DoHotkey
  Hotkey %c1%, KeyDown
 Hotkey %c1% UP, KeyUP
   Hotkey %c2%, KeyDown ; see post by guest below seems to improve the script haven't tried this myself so comment these two lines if it doesn't work
 Hotkey %c2% UP, KeyUP ;

}

return


; This key may help, as the space-on-up may get annoying, especially if you type fast.
Control & Space::Suspend

; Not exactly mirror but as close as we can get, Capslock enter, Tab backspace.
Space & CapsLock::Send {Enter}
Space & Tab::Send {Backspace}

; If spacebar didn't modify anything, send a real space keystroke upon release.
+Space::Send {Space}
Space::Send {Space}
 
; Define special key combos here (took them from RG's mod):
^1::Send {Home}
^2::Send {End}
^3::Send {Del}

; General purpose
DoHotkey:
  StartTime := A_TickCount
  StringRight ThisKey, A_ThisHotkey, 1
  i1 := InStr(original, ThisKey)
  i2 := InStr(mirrored, ThisKey)
  If (i1+i2 = 0) {
    MirrorKey := ThisKey
  } Else If (i1 > 0) {
    MirrorKey := SubStr(mirrored, i1, 1)
  } Else {
    MirrorKey := SubStr(original, i2, 1)
  }
 
  Modifiers := ""
  If (GetKeyState("LWin") || GetKeyState("RWin")) {
    Modifiers .= "#"
  }
  If (GetKeyState("Control")) {
    Modifiers .= "^"
  }
  If (GetKeyState("Alt")) {
    Modifiers .= "!"
  }
  If (GetKeyState("Shift") + GetKeyState("CapsLock", "T") = 1) {
    ; only add if Shift is held OR CapsLock is on (XOR) (both held down would result in value of 2)
    Modifiers .= "+"
  }

/*
  KeyWait, %ThisKey%, T1
  Send %Modifiers%{%MirrorKey%}
  If (A_TickCount - StartTime >= 1000)
     {
        StringUpper, MirrorKey, MirrorKey
   Send {Backspace}+%MirrorKey%
*/

If (KeyIsDown < 1 or ThisKey <> LastKey)
          {
               KeyIsDown := True
               LastKey := ThisKey
               Send %Modifiers%{%MirrorKey%}
               SetKeyDelay, 65535
               SetTimer, ReplaceWithUpperMirror, %UpperDelay%
          }

Return

Space & F1::
  ; Help-screen using SplashImage
  CoordMode Caret, Screen
  y := A_CaretY + 20
  If (y > A_ScreenHeight-100)
    y := A_CaretY - 20 - 100
  SplashImage HalfKeyboard_help.gif, B X%A_CaretX% Y%y%
  Sleep 5000
  SplashImage OFF
return

MenuExit:
  ExitApp
Return

KeyDown:
   Key:=A_ThisHotkey
        If (KeyIsDown < 1 or Key <> LastKey)
           {
                KeyIsDown := True
                LastKey := Key
                Send %Key%
                SetKeyDelay, 65535
                SetTimer, ReplaceWithUpper, %UpperDelay%
           }
        Return

KeyUp:
   Key:=A_ThisHotkey
        SetTimer, ReplaceWithUpper, Off
        SetTimer, ReplaceWithUpperMirror, Off
        KeyIsDown := False
        Return

ReplaceWithUpper:
SetKeyDelay, -1
Send {Backspace}+%LastKey%
Return

ReplaceWithUpperMirror:
SetKeyDelay, -1
Send {Backspace}+%MirrorKey%
Return

Edit3a: See post by guest below for
Code:
  Hotkey %c2%, KeyDown
  Hotkey %c2% UP, KeyUP
- tip June 8 2009

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Last edited by SoLong&Thx4AllTheFish on March 21st, 2011, 9:37 am, edited 9 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: Auto Upcase Press
PostPosted: October 31st, 2008, 4:13 pm 
Thank you for your work HugoV, this is close to perfection.

It works fine without space bar, but on mirrored upper keys it prints a second letter, in lower case.

I'm no programmer and don't know what to do about it, but I'd sure appreciate any help.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2008, 4:55 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
removed: script didn't perform as desired

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Last edited by SoLong&Thx4AllTheFish on November 4th, 2008, 11:47 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2008, 12:13 am 
HugoV, I've tested and re-tested your second edit, but it always doubles the pressed letter on key-up. Works fine on direct instances, but duplicates on mirrored ones.

I'm pretty sure there's an easier way to do it - easier than the long string of remapped keys. By grabbing the key just before being printed, as it's in a variable, it might be possible to put it through an 'if' that's going to test how long it's been pressed, and then capitalize it with something along the line of the mirroring string.

I don't know how to program it, I just got the idea, but I have a hunch the whole capitalization story might hold in a little scripted paragraph.

Let me know if you got any idea...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 4th, 2008, 11:46 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Bump. Try Edit3 above.

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thank You
PostPosted: November 6th, 2008, 12:48 am 
Thank you very much for posting this great script. I broke my left hand about 4 weeks ago and this has been a lifesaver. I am using Jonny's original version of the script and I can type around 30-40 wpm on this now (though I type more like 80-100 two handed). As a computer science master's student this has been pretty much essential. Thank you again.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2008, 1:31 pm 
HugoV, I've tested the edit 3 and it does a lot of funny things.
I'm going away for a couple of weeks and I'll draft a proper bug report when I return.


Report this post
Top
  
Reply with quote  
 Post subject: Thank you
PostPosted: November 21st, 2008, 6:21 pm 
just wanted to say thank you for this

I'm using it right now


Report this post
Top
  
Reply with quote  
PostPosted: December 16th, 2008, 4:43 am 
HugoV, sorry was away longer than I thought.
Any way I look at the edit 3 it does not work. It just doesn't. Maybe it's not doable. Ah well, thanks for trying anyway.
Best to you!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2008, 5:08 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
The Odd thing is that I have TYPED
this with edit3 withOUT problems.

Running WinXP, US keyboard/layout.

Sorry it doesn't work for you.

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2008, 6:14 am 
Offline

Joined: December 17th, 2008, 5:36 am
Posts: 80
this is really great guys. I am typing one handed at this very moment. Im not really sure what problems you other guys are having but the edit three script works great for me. unfortunately my typing is pretty slow but i can see it getting better pretty quick. I love this and just wanted to say thanks for all the hours put into it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2008, 3:24 am 
Ok so, I probably got a clash between the edit 3 and another script (I got a lot running).
I'm flying away this morning (after a white night, yes), and get back in a month. I'll fix it then. Let you know the outcome.

I'm delighted you got it to work HugoV. I look forward to using it. Thanks a lot for your expertise.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2008, 3:31 am 
Offline

Joined: December 28th, 2008, 11:14 pm
Posts: 3
i just stimbled across this thread and thought
how perfect this script is for use with this!

http://www.belkin.com/pressroom/releases/uploads/10_04_07n52te.html


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 8th, 2009, 12:03 am 
edit 3 works better if you add two lines in the loop defining the hotkeys
Code:
  Hotkey %c2%, KeyDown
  Hotkey %c2% UP, KeyUP


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 164 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot] and 11 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