Custom


[v10.6+]

ClipjumpCustom.ini is the medium to create scripts for Clipjump. Usually a script has 3-5 lines of code but can accomplish a lot.
The file is created and loaded when you start Clipjump.
It gives power to-

The basics

Clipjump Custom works on the principle of Sections ([section_name]) in Ini's. Each section in ClipjumpCustom.ini behaves as an independent script. You can add commands which is a key=value pair in these sections and they will be executed one by one when the section runs.
The sections are of 2 types - Auto-executing and Non-auto-executing .
The only difference between them, as the name suggests is that an Auto-executing section runs at Clipjump startup whereas it is not so for the other type.
A section becomes non-auto-executing only when it has a hotkey linked to it or when noautorun is set to 1 in that section. You will learn more on this topic later.

How it works ?

ClipjumpCustom.ini is interpreted by Clipjump at its startup. The ini is scanned for auto-executing sections and these are executed as soon as they are found. All sections are then kept in memory and executed later on when called.
So if you edit the ClipjumpCustom.ini while Clipjump is running, the change is not recorded by Clipjump. Therefore you need to reload ClipjumpCustom.ini from the tray menu.
Here is an example ClipjumpCustom.ini file

Commands

Here is the list of commands you can use in your ClipjumpCustom section (script). The syntax of all of these commands is command = value.
run
Runs a label or function or API function distributed with Clipjump. For a complete list of these, see API functions and routines list. See an example of using Run command here
bind
Binds a hotkey to the current section. This hotkey when pressed will execute that section. The bind command or rather the bind key can be present anywhere in the section to be recognizable.
It should also be noted that a section having a bind key doesn't autorun with Clipjump i.e. the section becomes non-auto-executing type. See this example using bind.
tip
Shows a tooltip with the text which is passed as value.
Example - tip = some text to show as tip
send
Artificially presses the key sequence that is passed as value. Example -
send = first line{enter}second line{tab}also in second line
The syntax is based on the AutoHotkey's send command. Use braces {} when you want to press the actual key.
Example - send = {Enter} and send = Enter produce different results. The first one presses the key Enter whereas the second one writes "Enter".
See this example on send to learn more.
sleep
Pauses the execution of section for the passed time in milliseconds.
Example - sleep = 1500 pauses the execution of running thread for 1500 milliseconds i.e 1.5 seconds
noautorun
If this variable is set to 1 anywhere in the section, the section doesn't auto-execute even without using the bind command.
Example - noautorun=1
Set this variable to 0 in a non-auto-executing section ( like the one using bind command ) to make it autorun.

Besides this you can also change the inner variables of Clipjump by using the variable = value syntax. Some of the most common variables needed to work highly requested features have been given in the following examples. Go through them and explore interesting tweaks and possibilities.
Note - The option to reload ClipjumpCustom.ini provided in the tray menu doesn't execute the auto-executing sections of the ini. If you change/add an auto-executing section in the ini, you will have to restart Clipjump to load them.

Examples

Example 1 (Shortcut to toggle Incognito Mode)

[toggle_incognito]
bind=Win+Alt+I
run=incognito
tip=Incognito Mode toggled
The above code uses 3 commands, bind, run and tip.
  1. Bind creates a shortcut for the section meaning that the section will not auto-execute at Clipjump start. Here that shortcut is Win + Alt + I.
  2. run runs the label 'incognito' inside Clipjump which is responsible for toggling incognito mode. More labels are here
  3. tip shows a tooltip when this custom function is run. Here the tip shown will contain the text Incognito Mode toggled.
Note that you can also use noautorun=1 to prevent auto-execution of section even if it doesn't have a 'bind'.


Example 2 (changing paste-format key to Y)

[AutoRun]
pastemodekey.z=y
The above code changes the inbuilt variable pastemodekey.z to 'y'.
If you remember, Z is the default key for toggling Paste formats in Paste Mode. The above code changes it to Y. It is mandatory to write pastemodekey in pastemodekey.z because pastemodekey is the object name which has this setting.
The Pastemode group has all variables as pastemodekey.key where key is the original key. Same is for [Search-Paste Mode]. It has all variables as spmkey.key. So the following code will change Channel up, Channel down and paste-format shortcut in [Paste-Mode] and cancel shortcut in [Search-Paste Mode].
[AutoRun]
pastemodekey.z=y
pastemodekey.up=q
pastemodekey.down=d
spmkey.home=PgDn
The key names are according to the AutoHotkey key list.

Example 3 (Shortcut to check for updates)

[section_name_can_be_anything]
run=updt
bind=Win+Alt+U


Example 4 (Shortcut to paste current content on system clipboard instantly [without formatting])

[paste_current]
bind=Ctrl+Shift+V
run=simplePaste

[paste_without_formatting]
bind=Win+V
run=API.runPlugin("noformatting_paste.ahk")
The above code has 2 examples, [paste_current] is to paste current clipboard as it is and [paste_without_formatting] is to paste current clipboard without formatting.

Example 5 (Instantly switching to your favorite channel)

Suppose your favorite channel is #4 as it stores some important web links. We will use the inbuilt changeChannel function in Clipjump to do the purpose.
[changeto_4]
bind=Win+4
run=changeChannel(4)
tip=Channel changed to 4


Example 6 (Running a ClipjumpCustom script with Action Mode)

Suppose you don't want to create a separate shortcut Win+V for the above example. Here is how to create a [Action Mode] shortcut for it.
[changeto_4]
noautorun=1
; noautorun prevents auto-execution of a section in absence of bind
run=changeChannel(4)
tip=Channel changed to 4

[actionmode_f10]
; here I don't use noautorun as I want it to run at startup and make the change
ACTIONMODE.F10 = API.executeSection(changeto_4)
ACTIONMODE.F10_caption = Change 2 my channel


Example 7 (Paste Your Contact Details)

If you give a unique tag to a clip with some specific information, then it can be retrieved anytime using the getclipDataByTag() function and pasted using the pasteText() function.
[paste_address]
bind=Ctrl+F8
zAddr=%API.getClipDataByTag(my_address)%
run=API.pasteText(%zAddr%)

Note It must be noted that Clipjump doesn't support nesting of %..%. So something like zAddr = %API.getClipDataByTag(%some_variable%)% is invalid. However the output of run command is stored in variable ans.So the above code can be written as -
[paste_address]
bind=Ctrl+F8
run=API.getClipDataByTag(my_address)  	
; now you can use API.getClipDataByTag(%some_variable%)
run=API.pasteText(%ans%)


Example 7.5 (Getting the clip to paste)

You can use the inbuilt inputbox() function to retrieve the clipno to paste. This procedure can also be done for the channelno.
[paste_sig]
bind = Ctrl+F8
zClipno = 1
; zClipno = %inputbox("Choose", "Please write the clip number to be pasted")%
run = API.paste( 2, %zClipno% )


Example 8 [SEND] (Filling Form)

The first example using Send. As briefed above, the command sends or stimulates a key press.
So to get started, know that 'Send' has some rules which must be noted.

Situation - Suppose you want to fill a web form with 4 fields and the fields focus can be switched with TAB, here is the customization to use -
[fill_that_form]
bind=Ctrl+Shift+F9
run=API.paste(,1)
send={tab}
run=API.paste(,2)
send={tab}
run=API.paste(,3)
send={tab}
run=API.paste(,4)


Example 9 (moving clips)

We will use the API.manageClip(new_channel, channel, clip, flag) function here. channel and clip default to the current active ones if no value for them is passed.
Situation - Suppose you copied a trash / incorrect information in the current protected / normal channel accidentally. Here is the code to move it to Pit channel which is say at channel number 2
[trash_clip]
bind=Ctrl+Win+Del
run=API.manageClip(2,,,0)
tip=The current active clip was trashed
The last parameter flag is 0 for move and 1 for copy. Here we are moving the clip.


Example 10 (paste mode with search enabled; no need to hold Ctrl)

If you don't like holding down Ctrl to navigate clips, this if for you. This Customization will bind Win + V to open paste mode with Search enabled so you will be able to use Up/Down keys to navigate through the clips.
[paste_with_search]
bind=Win+V
spm.active=1
run=paste
run=searchpm


Example 11 (emptying a channel)

[empty_pit]
bind=Win+Alt+E
run=API.emptyChannel(pit)
tip=Pit Channel is now empty
The above uses the API.emptyChannel(channel_no) function. If channel_no is empty i.e nothing is passed as this parameter , the current active channel is taken into account. If channel_no is not number, a channel with name as channel_no is taken into account. If channel_no is number, it is supposed that channel_no contains a channel number to be used.


Example 12 (Variables concept and STORE.)

[SEC1]
STORE.myVar = text in store.myvar
anotherVar = text in anotherVar
tip = %STORE.myVar%
sleep = 1000
tip = %anotherVar%
sleep = 1000

[SEC2]
tip = Sec2 is now started
sleep = 1000
run = API.showTip(%STORE.myVar%, 1000)
tip = %anotherVar%
sleep = 1000

Note - A list of all API functions, key label, routines and general functions and Interesing Variables can be found on Developer's Reference Page.
It is recommended to have a look at them when you complete this guide.

If you need help on Customizations, you can ask in comments on the main site or from any of links in the contact page.



Translate