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

Clip Hotkeys - Another Update

Expand Messages
  • Sheri
    I fixed the file naming problem, you shouldn t have to worry about invalid characters in your clip name anymore. This clip can be viewed and copied without
    Message 1 of 1 , Sep 13, 2002
    • 0 Attachment
      I fixed the file naming problem, you shouldn't have to
      worry about invalid characters in your clip name anymore.

      This clip can be viewed and copied without broken lines around

      http://groups.yahoo.com/group/ntb-scripts/messages/48?expand=1


      These hotkeys work in an existing Notetab session to trigger
      associated clips. The library is changed if necessary and
      the clip is run. For example, you could assign Ctrl+Alt+D
      to Duplicate Line in the Utilities Library. Then, while
      editing a document, Ctrl+Alt+D will duplicate the current
      line. But while in ClipEdit mode, it will only change
      libraries and select the target clip.

      Allowable key combinations via this clip are Ctrl+Alt+[any
      letter or number]. Some combinations may not work;
      Ctrl+Alt+O doesn't for me. If you subsequently relocate the
      shortcut files or change the hotkey assignments, you may
      have to reboot. Also, hotkey'ed shortcuts must reside be on
      the Windows Desktop or in the Start Menu hierarchy or
      Windows won't respond to the hotkey. This clip places them
      in a Hotkeys folder off the Start Menu.

      To use this clip, it must be run from the Clipbar, and you
      must select (highlight) a target clip in a Clipbook in
      advance. Be aware that the Clip name is used in the
      resulting shortcut file name. If there are invalid
      characters in the Clip name, underscores are substituted.
      Only the first 45 characters will be used in the shortcut
      file name.

      Notetab Light users could use this clip, but the only clip
      that can be targeted without a Clipbar is this one. But
      using Windows Explorer, you could edit the output shortcut
      properties to target different libraries/clips.

      Neither the library where "Make Windows Hotkey for Clip" nor
      the library home of the target clip can have an
      OnClipboardChange clip in them for this clip to properly
      create a shortcut/hotkey. If necessary, temporarily rename
      OnClipboardChange and make sure it is not resident before
      starting this clip. The clip will (hopefully) detect if you
      forget, and will exit without hanging.

      The previously discussed Hotkey utilities are Hotkey
      Detective 2 http://www.pcmag.com/utilities/ and Shortcut Map
      http://www.zealsoft.com/

      If you have installed either to its default directory (in
      the case of Hotkey Detective, left a start menu shortcut in
      the default location), you need not "Define Hotkey Utility".

      I've tried to explain the ini issues in the clip's
      prompting. You should only need to specify one if your
      primary Notetab session is started with a command line that
      includes the /INI=someini.ini parameter.

      H="Make Windows Hotkey for Clip"
      ;09/13/02 fixed shortcut file naming problem when clip name has invalid characters
      ;09/12/02 enhanced version posted
      ;now has options to launch hotkey utilities
      ;and can optionally include a /INI parameter in the shortcut's command line
      ;and various fixes and improvements
      ;09/05/02 by Sheri Pierce
      ^!SetScreenUpdate Off
      ;Need Hotkeys directory, once created the ^!Mkdir doesn't hurt anything
      ^!MkDir ^$GetSpecialPath(Programs)$Hotkeys
      :Begin
      ^!Set %Action%=^?{Choose one==Define Hotkey Utility^=D|Launch Hotkey Utility^=L|_Assign Hotkey to Currently Selected Clip^=A|Exit}
      ^!IfCancel End
      ^!If ^%Action%=D DefineUtility
      ^!If ^%Action%=L LaunchUtility
      ^!If ^%Action%=Exit End
      ^!Set %ContMsg%=Highlight the clip to be hotkeyed then^%nl%launch this clip from the clipbar.^%nl%^%nl%Cancel if you haven't done this...
      ^!IfDiff "^$GetIniFile$" "^$ChangeFileExt("^$GetAppFileName$";"ini")$" Next Else Skip_2
      ^!Set %PossIni%=^$GetIniFile$
      ^!Append %ContMsg%=^%nl%^%nl%Also, be aware that your current INI file is: ^$GetIniFile$. If this ini is in use because of its inclusion in a /INI startup parameter, the same parameter must be on any hotkey shortcuts to be used in the corresponding session. You will have the opportunity to elect to include an INI in the launch string for the hotkey.
      ^!Continue ^%ContMsg%
      ^!IfAppOpen "Hotkeys" Next Else Start
      ^!Set %ContMsg%=^%nl%Highlight the clip to be hotkeyed then^%nl%launch this clip from the clipbar.^%nl%^%nl%Cancel if you haven't done this...
      ^!FocusApp "Hotkeys"
      ^!Delay 1
      ^!IfSame "Hotkeys" "^$GetAppTitle$" Next Else Skip_-1
      ^!Delay 1
      ^!Keyboard ALT+F UP ENTER
      ^!Delay 2
      ^!IFAppOpen "Hotkeys" Next Else Skip_2
      ^!Prompt Clip couldn't close Explorer's Hotkey Window. Manually close it and restart this clip.
      ^!Goto End
      :Start
      ;Make sure there is no OnClipboardChange in the current library.
      ^!Set %Curdoc%=^$GetDocIndex$
      ^!Open "^$GetLibraryPath$^$GetLibraryName$.clb"
      ^!Find "^H="_*OnClipboardChange"" IRWS
      ^!IfError Next Else NotCompat
      ^!Close "^$GetLibraryPath$^$GetLibraryName$.clb"
      ^!SetDocIndex ^%Curdoc%
      ;Turn on ShowHeaders to facilitate getting Clip name
      ^!ProginiSave
      ^!Set %SHVal%=^$GetValue("Clipbook:ShowHeaders")$
      ^!If ^%SHVal%=1 Skip_2
      ^!SaveValue Clipbook:ShowHeaders=1
      ^!ProginiLoad
      ^!SetFocus ClipEdit
      ^!Jump Text_Start
      ^!Select Line
      ^!Set %ClipSel%=^$StrDeleteRight("^$GetSelection$";2)$
      ^!IfFalse ^%Curdoc%=^$GetDocIndex([Clips])$ Next Else Skip_2
      ^!SetDocIndex ^$GetDocIndex([Clips])$
      ^!Menu Close
      ^!ClipBoardSave
      ;Copy Library Name from Clipbook dropbox
      ^!Keyboard Ctrl+F6
      ^!Delay 1
      ^!Keyboard Ctrl+C
      ^!Set %ClipLib%=^$GetClipboard$
      ^!Set %ClipAssign%=^%ClipLib%:^%ClipSel%
      ;See if this is the same library as currently loaded and previously searched for OnClipboardChange
      ^!If "^$GetLibraryPath$^$GetClipboard$.clb"="^$GetLibraryPath$^$GetLibraryName$.clb" Skip_4
      ^!Open "^$GetLibraryPath$^$GetClipboard$.clb"
      ^!Find "^H="_*OnClipboardChange"" IRWS
      ^!IfError Next Else NotCompat
      ^!Close "^$GetLibraryPath$^$GetClipboard$.clb"
      ^!Set %ClipAssign%=^%ClipLib%:^%ClipSel%
      ^!SetDocIndex ^%Curdoc%
      ^!Set %Msg%=Ctrl+Alt+?^P
      ^!Append %Msg%=Press Tab and Enter Letter or Number for^P
      ^!Append %Msg%=Clip titled "^%ClipSel%"
      ^!Set %Display%=^?{(T=M)==^%Msg%}; %Key%=^?{(M="A";H=1)Ctrl+Alt+?}
      ^!IfCancel End
      ^!Set %Key%=^$StrUpper("^%Key%")$
      ;Convert the Clip Name to a valid filename
      ^!Set %ClipSel%=^$StrTrim(^$StrCopyLeft("^%ClipSel%";45)$)$
      ^!Set %ClipSel%=^$StrReplace("/";"_";"^%ClipSel%";False;False)$
      ^!Set %ClipSel%=^$StrReplace("\";"_";"^%ClipSel%";False;False)$
      ^!Set %ClipSel%=^$StrReplace("?";"_";"^%ClipSel%";False;False)$
      ^!Set %ClipSel%=^$StrReplace("*";"_";"^%ClipSel%";False;False)$
      ^!Set %ClipSel%=^$StrReplace("|";"_";"^%ClipSel%";False;False)$
      ^!Set %ClipSel%=^$StrReplace(""";"_";"^%ClipSel%";False;False)$
      ^!Set %ClipSel%=^$StrReplace("<";_";"^%ClipSel%";False;False)$
      ^!Set %ClipSel%=^$StrReplace(">";"_";"^%ClipSel%";False;False)$
      ^!Set %ClipSel%=^$StrReplace("%";"_";"^%ClipSel%";False;False)$
      ^!Set %ClipSel%=^$StrReplace(":";"_";"^%ClipSel%";False;False)$
      ^!Set %SCName%=^%ClipSel%-Ctrl+Alt+^%Key%
      ^!IfFileExist "^$GetSpecialPath(Programs)$^%SCName%.lnk" Next Else Skip_2
      ^!Prompt There is already a shortcut named "^$GetSpecialPath(Programs)$^%SCName%.lnk", Exiting...
      ^!Goto End
      :IniElect
      ^!Set %IniWizChoice%=_Notetab's Default^=D|
      ^!IfFalse ^$IsEmpty(^%PossIni%)$ Next Else Skip_1
      ^!Append %IniWizChoice%=^%PossIni%|
      ^!Append %IniWizChoice%=Browse to File^=B
      ^!Set %IniElect%=^?{Ini Option==^%IniWizChoice%}
      ^!IfCancel End
      ^!If ^%IniElect%=D Next Else ChooseIni
      ^!Set %IniParm%=^%Empty%
      :MakeIt
      ;First record shortcut in Shortcuts.dat file
      ^!Open ^$GetAppPath$Shortcuts.Dat
      ^!Jump Doc_Start
      ^!InsertText ;Ctrl+Alt+^%Key% **CLIP** ^%ClipAssign%^P
      ^!Save
      ;Ini parameter will be inserted later, couldn't make it work in the MakeShortcut
      ^!MakeShortcut Programs "^$GetAppFileName$" "/L="^%ClipAssign%"" "^%SCName%"
      ^!Delay 1
      ^!IfFileExist "^$GetSpecialPath(Programs)$^%SCName%.lnk" Next Else Skip_-1
      ^!MoveFile "^$GetSpecialPath(Programs)$^%SCName%.lnk" "^$GetSpecialPath(Programs)$Hotkeys\^%SCName%.lnk"
      ^!Delay 1
      ^!IfFileExist "^$GetSpecialPath(Programs)$Hotkeys\^%SCName%.lnk" Next Else Skip_-1
      ^!Shell Explorer.exe /select, "^$GetSpecialPath(Programs)$Hotkeys\^%SCName%.lnk"
      :Wait
      ^!IfAppOpen "Hotkeys" Next Else Wait
      ^!FocusApp "Hotkeys"
      :EditShortcutProperties
      ^!IfSame "Hotkeys" "^$GetAppTitle$" Next Else Skip_-1
      ^!Keyboard F2 CTRL+C ESC
      ^!Delay 2
      ^!IfSame "^%SCName" "^$GetClipboard$" Next Else Skip_-1
      ^!Delay 2
      ^!Keyboard Alt+Enter
      ^!Delay 2
      ^!IfAppOpen "*Properties" Next Else Skip_-1
      ^!FocusApp "*Properties"
      ^!IfMatch ".*Properties$" "^$GetAppTitle$" Next Else Skip_-1
      ^!SetClipboard ^%IniParm%
      ^!Keyboard END CTRL+V TAB
      ^!SetClipboard "^$StrDeleteRight("^$GetAppPath$";1)$"
      ^!Keyboard CTRL+V TAB #^%Key%# Enter
      ^!Delay 5
      :CloseExplorer
      ^!IfAppOpen "*Properties" Skip_-1 Else Next
      ^!FocusApp "Hotkeys"
      ^!Delay 1
      ^!IfSame "Hotkeys" "^$GetAppTitle$" Next Else Skip_-1
      ^!Delay 2
      ^!Keyboard ALT+F UP ENTER
      ^!Delay 4
      ^!IFappOpen "Hotkeys" Next Else Skip_1
      ^!Prompt Couldn't Close Explorer's Hotkey Window - do so manually after completion of clip.
      ^!ActivateApp
      :RestoreClipHeadSet
      ;This Notetab option setting was previously saved
      ^!If ^%SHVal%=1 Skip_2
      ^!SaveValue Clipbook:ShowHeaders=0
      ^!ProginiLoad
      ^!Goto End
      :DefineUtility
      ^!SaveValue HotkeyUtility=^?{(T=O;F="Applications(*.exe;*.lnk)|*.exe;*.lnk")Locate and Select Hotkey Utility}
      ^!IfCancel Begin
      ^!Goto Begin
      :LaunchUtility
      ^!IfTrue ^$IsEmpty(^$GetValue("HotkeyUtility")$)$ Skip_3 Else Next
      ^!Chdir "^$GetPath(^$GetValue("HotkeyUtility")$)$"
      ^!ShellWait "^$GetFileName(^$GetValue("HotkeyUtility")$")$
      ^!Goto Begin
      ^!IfFileExist "^$GetSpecialPath(Programs)$PC Magazine Utilities\Hotkey Detective.lnk" Next Else Skip_2
      ^!ShellWait "^$GetSpecialPath(Programs)$PC Magazine Utilities\Hotkey Detective.lnk"
      ^!Goto Begin
      ^!IfFileExist "C:\Program Files\Shortcuts Map\shctmap.exe". Next Else Skip_3
      ^!Chdir "C:\Program Files\Shortcuts Map\"
      ^!ShellWait shctmap.exe
      ^!Goto Begin
      ^!Info No Utility Found.^%nl%Please define a Hotkey utility.
      ^!IfCancel Begin
      ^!Goto Begin
      :Chooseini
      ^!If ^%IniElect%=B Skip_2
      ^!Set %chosenini%=^%IniElect%
      ^!Goto SetIni
      ^!Set %chosenini%=^?{(T=O;F="Ini Files(*.ini)|*.ini")Browse to directory and select an alterate ini file}
      ^!IfCancel IniElect
      :SetIni
      ^!If ^$GetPath(^%chosenini%)$=^$GetAppPath$ Next Else Skip_1
      ^!Set %chosenini%=^$GetFileName(^%chosenini%)$
      ^!Set %chosenini%=^$StrDeleteRight(^$GetShort(^%chosenini%)$;4)$
      ^!Set %IniParm%=^%Space%/INI=
      ^!Append %IniParm%=^%chosenini%
      ^!Goto MakeIt
      :NotCompat
      ^!Close "^**"
      ^!Prompt Either the Starting or Selected Library has an OnClipboardChange clip - Exiting due to incompatibility, temporarily rename it and retry.
      ^!Goto End
      :End
      ^!SetDocIndex ^%Curdoc%
      ^!ClearVariable %Action%
      ^!ClearVariable %ContMsg%
      ^!ClearVariable %PossIni%
      ^!ClearVariable %Curdoc%
      ^!ClearVariable %SHVal%
      ^!ClearVariable %ClipSel%
      ^!ClearVariable %ClipLib%
      ^!ClearVariable %ClipAssign%
      ^!ClearVariable %Msg%
      ^!ClearVariable %Display%
      ^!ClearVariable %Key%
      ^!ClearVariable %SCName%
      ^!ClearVariable %IniWizChoice%
      ^!ClearVariable %IniElect%
      ^!ClearVariable %IniParm%
      ^!ClearVariable %chosenini%
      ^!ClipBoardRestore
      ;end of clip
    Your message has been successfully submitted and would be delivered to recipients shortly.