Any idea how I could do the same on Linux?
Andre wrote:
> I spent the last three days programming in C using Dasher, and what made
> my life much easier was a program named AutoHotKey [1]. I wrote a small
> script for it that allows me to easily and quickly enter and exit the
> Dasher window without having to use the mouse or pressing many keys.
>
> Basically, you press F12 to open the Dasher window, type whatever you
> need in it, and then press F12 again to go back to the original window,
> and have all the text you typed in Dasher entered into that original
> window. Note that I don't have to start or stop Dasher manually, I just
> press F12, mouse, and F12 again.
>
> The result was that I was always in my editor window (VIM) and only in
> Dasher when actually typing (Dashering)! :-)
>
> To use this script: install AutoHotKey, copy the script into a file with
> the extension .ahk and double click it. In Dasher, the option "Start on
> space bar" must be enabled.
>
> The script:
>
> ; Tested with Dasher 4.2.2 and AutoHotKey 1.0.46.01.
> ; Set "Start on space bar".
>
> F12::
> #WinActivateForce
> SetDefaultMouseSpeed, 0
> if on = 1
> {
> on = 0
> IfWinExist, ahk_class DASHER
> {
> IfWinNotActive
> {
> WinActivate
> WinWaitActive
> }
>
> ; Copy the text typed in Dasher to the clipboard, stop Dasher
> and minimize its
> ; window.
> clipboard =
> SendInput, {F5}
> SendInput, ^n ;[1]
> WinMinimize
>
> ; If the original window still exists, then bring it to the
> front and paste
> ; the Dashered text into it.
> IfWinExist, ahk_id %old_winid%
> {
> WinActivate
> WinWaitActive
> ; Ways for pasting:
> ; Middle click
> ;MouseMove, old_x, old_y
> ;MouseClick, middle
> ; Control-V
> ;SendInput, ^v
> ; Typing the characters.
> text := RegExReplace(clipboard, "\r\n", "`n")
> SendInput, {Raw}%text%
>
> ; Uncomment if you want to restore the original cursor
> position.
> ;MouseMove, old_x, old_y
> }
> Else
> {
> MsgBox, I can't find the original window. The text you typed
> is in the clipboard.
> }
> }
> }
> else
> {
> ; If the "save changes?" window is open, choose no.
> IfWinExist, Unsaved changes
> {
> ControlClick, &No,,,,, NA
> }
>
> IfWinExist, ahk_class DASHER
> {
> IfWinActive
> {
> MsgBox, Go to the window you'd like to type in and press the
> hotkey again.
> return
> }
>
> on = 1
>
> ; Remember the cursor position and the front window.
> MouseGetPos, old_x, old_y, old_winid
>
> ; Maximize Dasher and bring it to the front.
> WinMaximize
> WinActivate
> WinWaitActive
>
> ; Position the cursor on the center of the Dasher input area.
> ControlGetPos, x, y, w, h, CANVAS1
> MouseMove, (x + w / 2 + 29), (y + h / 2)
>
> ; Dasher >= 4 : sets Dasher speed to the configured value. The
> first ^n at [1]
> ; will have Dasher's actual speed half of that configured.
> SendInput, ^n
>
> ; Start Dasher.
> ControlFocus, CANVAS1
> SendInput, {Space}
> }
> Else
> {
> MsgBox, You must run Dasher manually.
> }
> }
> return
>
> --
>
> [1] http://www.autohotkey.com/
|