Loading ...
Sorry, an error occurred while loading the content.

9134Re: [Clip] intercept key strokes

Expand Messages
  • Wayne VanWeerthuizen
    Oct 4, 2002
    • 0 Attachment
      This clip does not do what you want - but people here may still
      find it interesting...

      To use the clip, click the mouse on each of the "keys" in the
      document. Click STOP or hole Ctrl+Shift to end clip/

      This clip is merely experimental, and has not practical use
      that I know of. Due how windows handles "focus events", this
      clip is not able to catch keys sent to pop-up menus in
      other programs.

      In case Yahoo wraps lines in the wrong places -- each of the
      InsertText lines ends with ^P.




      H="Simulated Keyboard"
      ; Simulated Keyboard
      ; Wayne VanWeerthuizen
      ; 2002-09-20

      ; This clip is experimental, and still contains bugs.

      ^!Set %AppName%="^?{Name of Application to Send Keys
      To=NoteTab*|*Microsoft Word }

      ^!SetScreenUpdate OFF
      ^!Toolbar New Document
      ^!SetPasteIndent OFF

      ^!Set %MS%="SHIFT OFF"
      ^!Set %MC%="CTRL OFF"
      ^!Set %MA%="ALT OFF"

      ^!InsertText ^P
      ^!InsertText ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
      ^P
      ^!InsertText ` 1 2 3 4 5 6 7 8 9 0 - = BACKSPACE
      ^P
      ^!InsertText TAB Q W E R T Y U I O P [ ]
      ^P
      ^!InsertText A S D F G H J K L ; ' ENTER
      ^P
      ^!InsertText Z X C V B N M , . / \
      ^P
      ^!InsertText SPACEBAR
      ^P
      ^!InsertText
      ^P
      ^!InsertText INSERT HOME PAGEUP UP
      ^P
      ^!InsertText DELETE END PAGEDOWN LEFT DOWN RIGHT HELP
      ^P
      ^!InsertText ^P^P^P^P^P

      :RedisplayModifiers
      ^!Jump 12
      ^!Select LINE
      ^!InsertText [^%MS%] [^%MC%] [^%MA%] [STOP]^P

      :MainLoop
      ^!Jump Doc_Start
      ^!SetScreenUpdate ON
      :WaitingLoop
      ^!Delay 1
      ^!Jump SELECT_END
      ^!Set %Row%="^$GetRow$"; %Col%="^$GetCol$"
      ^!Set %S%="^$IsShiftKeyDown$"; %A%="^$IsAltKeyDown$"; %C%
      ="^$IsCtrlKeyDown$"
      ^!If ^%Row% = 1 WaitingLoop
      ^!SetScreenUpdate OFF
      ^!IfInRange ^%Row% 2..10 MainKeyboard
      ^!If ^%Row%=12 ModifierKeys
      ^!Goto MainLoop

      :MainKeyboard
      ^!IfDiff "^$GetChar$" " " GotKey
      ^!MoveCursor -1
      ^!IfDiff "^$GetChar$" " " GotKey
      ^!Goto MainLoop

      :GotKey
      ^!Set %Key%=^$GetChar$
      ^!IfFalse ^$IsAlphaNumeric(^%Key%)$ SKIP_2
      ^!Select WORD
      ^!Set %Key%=^$GetSelection$
      ^!Jump DOC_END
      ^!ClearVariable %Modifiers%

      ^!IfDiff "^%MS%" "SHIFT OFF" SKIP
      ^!IfTrue ^%S% NEXT ELSE SKIP
      ^!Append %Modifiers%="Shift+"

      ^!IfDiff "^%MC%" "CTRL OFF" SKIP
      ^!IfTrue ^%C% NEXT ELSE SKIP
      ^!Append %Modifiers%="Ctrl+"

      ^!IfDiff "^%MA%" "ALT OFF" SKIP
      ^!IfTrue ^%A% NEXT ELSE SKIP
      ^!Append %Modifiers%="Alt+"

      ^!InsertText ^%Modifiers%^%Key%
      ^!If ^$GetCol$>50 ^!InsertText ^P

      ^!FocusApp "NoteTab Std*"
      ^!Keyboard ^%Modifiers%^%Key%

      :HandleModifiers
      ^!IfSame "^%MS%" "SHIFT ON" ^!Set %MS%="SHIFT OFF"
      ^!IfSame "^%MC%" "CTRL ON" ^!Set %MC%="CTRL OFF"
      ^!IfSame "^%MA%" "ALT ON" ^!Set %MA%="ALT OFF"
      ^!Goto ModsDone

      :ModifierKeys
      ^!SetHintInfo ModifierKeys ^%Col%
      ^!IfInRange ^%Col% 3..15 Shift
      ^!IfInRange ^%Col% 18..30 Control
      ^!IfInRange ^%Col% 33..45 Alt
      ^!IfInRange ^%Col% 51..55 Stop
      ^!Goto MainLoop

      :Stop
      ^!StatusShow Ending Program.
      ^!Delay 3
      ^!Goto EXIT

      :Shift
      ^!IfDiff "^%MS%" "SHIFT ON" SKIP Else ^!Set %MS%="SHIFT LOCKED"
      ^!Goto ModsDone
      ^!IfDiff "^%MS%" "SHIFT LOCKED" SKIP Else ^!Set %MS%="SHIFT OFF"
      ^!Goto ModsDone
      ^!IfDiff "^%MS%" "SHIFT OFF" SKIP Else ^!Set %MS%="SHIFT ON"
      ^!Goto ModsDone
      :Control
      ^!IfDiff "^%MC%" "CTRL ON" SKIP Else ^!Set %MC%="CTRL LOCKED"
      ^!Goto ModsDone
      ^!IfDiff "^%MC%" "CTRL LOCKED" SKIP Else ^!Set %MC%="CTRL OFF"
      ^!Goto ModsDone
      ^!IfDiff "^%MC%" "CTRL OFF" SKIP Else ^!Set %MC%="CTRL ON"
      ^!Goto ModsDone
      :Alt
      ^!IfDiff "^%MA%" "ALT ON" SKIP Else ^!Set %MA%="ALT LOCKED"
      ^!Goto ModsDone
      ^!IfDiff "^%MA%" "ALT LOCKED" SKIP Else ^!Set %MA%="ALT OFF"
      ^!Goto ModsDone
      ^!IfDiff "^%MA%" "ALT OFF" SKIP Else ^!Set %MA%="ALT ON"
      :ModsDone
      ^!ClearVariable %Modifiers%
      ^!IfDiff "^%MS%" "SHIFT OFF" ^!Append %Modifiers%="Shift+"
      ^!IfDiff "^%MC%" "CTRL OFF" ^!Append %Modifiers%="Ctrl+"
      ^!IfDiff "^%MA%" "ALT OFF" ^!Append %Modifiers%="Alt+"
      ^!Goto RedisplayModifiers

      :END
      ; Clip MD5: 2ab26e2e3e62bf613e1c3338fbb6eb45
    • Show all 4 messages in this topic