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

Re: [Clip] intercept key strokes

Expand Messages
  • Jody
    Hi Mike H, ... No, there is not. Sometime in v5 we will have a recorder that will do what you want. Depending on what you are doing though you might be able
    Message 1 of 4 , Oct 3 11:00 AM
      Hi Mike H,

      >1.) How do I intercept keystrokes in a clip. I know about
      >^$IsShift|Control|Alt$, but is there any way to intercept the
      >remaining key signals?

      No, there is not. Sometime in v5 we will have a recorder that
      will do what you want. Depending on what you are doing though
      you might be able to use testing statements/Testing Conditions.

      (IfSame, IfDiff, IfTrue, If, IfMatch, ^$IsEmpty(...)$ etc...)
      Look up "Testing Conditions" in Help | Help on Clip Programming.
      %Variable% would be set by user input in a wizard.

      ^!Set %Variable%=^?{Click on n item=Do this^=1|Do this^=2|...}

      ^!IfSame "Data1" "^%Variable%" GotoLabel esle Next
      ^!IfSame "Data2" "^%Variable%" GotoLabel esle Next
      ^!IfSame "Data3" "^%Variable%" GotoLabel esle Next

      ---

      You can force certain items to be clicked on with the following.
      Use ^!IfCancel it an input is required.

      ; try typing something other than the "I" (ItemN).
      ^!Set %combobox%=^?{(T=C)Force entry combobox==Item1|Item2|Item3}
      ^!Set %listbox%=^?{(T=L)Force entry listbox=Item1|Item2|Item3}
      ^!Set %expanded%=^?{(T=H)Force entry expanded==Item1|Item2|Item3}
      ^!Set %checkbox%=^?{(T=A)Force entry checkboxes==Item1|Item2|Item3}

      ^!Info [L]^%combobox%^p^p^%listbox%^p^p^%expanded%^p^p^%checkbox%

      You can also use masked inputs.

      See "Clip Wizard and Fields" in Help | Help on Clip Programming.

      Happy Clip'n!
      Jody

      http://www.notetab.net

      Subscribe, UnSubscribe, Options
      mailto:Ntb-Clips-Subscribe@yahoogroups.com
      mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
      http://groups.yahoo.com/group/ntb-clips
    • Wayne VanWeerthuizen
      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.
      Message 2 of 4 , Oct 4 3:26 AM
        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
      Your message has been successfully submitted and would be delivered to recipients shortly.