HotPaste Plugin
Introduction
HotPaste plugin, an idea inspired from AutoHotkey hotstrings helps you create hot-words that perform action when you type. The basic actions can be pasting a text from a Clipjump channel or through a function.Raw strings can be pasted from
API.pasteText()
function whereas clips can be pasted from API.paste(channel, clip)
function. The
pasteText()
will only be able to paste unformatted text so for any HTML or picture type of clip, you will have to rely on paste()
.
You can create Hotpastes (i.e. "Hot-words") in the plugins\hotpaste.lib\base.ahk file. This file in not distributed by default and you will have to run HotPaste from the Plugin Manager to have this file created. Once created, you will have to edit the file to add your HotPastes.
After editing base.ahk, restart Clipjump to have your edits loaded.
Basic syntax and Usage
A simple base.ahk goes as-; writing 'cj_site' followed by a space/Enter/Tab will PASTE the site URL ::cj_site:: API.PasteText("http://clipjump.sourceforge.net") return ; writing 'my_add' followed by a space/Enter/Tab will PASTE 2nd clip of channel 0 ::my_add:: API.Paste(0, 2) returnThe above code creates two HotPastes -
cj_site
and my_add
.
- As the comments read, writing
cj_site
and then pressing Enter or Space or Tab will replace the typed 'cj_site' by http://clipjump.sourceforge.net. ThePasteText()
function is responsible for pasting this plain text. Note that I have surrounded the literal string in quotes (""). - The 2nd HotPaste
my_add
when typed invokesPaste()
function of the API to paste clip 2 of channel 0. The typed text 'my_add' will be replaced by the clip 2 of channel 0 in this case. As this time there is no literal string as input, I have not used quotes.
So the basic syntax is -
::HOTPASTE:: API.Paste or API.pasteText returnIf you have knoweledge of AutoHotkey, there is no limit to what HotPaste can do for you. After all, HotPaste is a simple plugin that uses the core feature of AutoHotkey for its purpose.
BTW, this doesn't mean you will have to learn AutoHotkey (AHK) to use it. This simple tutorial will be sufficient.
Examples
Pasting multi-line text
Multiline separator in Autohotkey is`n
.
::longstr:: API.PasteText("103, Abc road`nCantt. Area`nXyz`nIndia") return
Pasting 2nd clip of current channel
CN.NG
variable contains the current active channel number. See more variables.
::2ndlast:: API.Paste( CN.NG, 2 ) return
End notes
- Make sure you resart Clipjump after changing base.ahk to have the changes loaded.
- It will be a good idea to fix clips that you access through
API.Paste()
because of the simple reason that clip number will change on addition of new clips. It would be better if you maintain all such FIXED clips in an entirely different channel to avoid workflow problems.
Translate