Extensions: Documentation And Source Code PopClip Extensions
PopClip extensions add extra actions to PopClip.
This repository contains the documentation for making your individual extensions (this readme file) as well as the source files for the extensions published on the primary PopClip Extensions page.
All extension source files are published under the MIT License (see LICENSE) unless noted otherwise within the readme files of individual extensions.
All the extensions and documentation were created by Nick Moore, except where stated. Contributor credits are are shown in the readme file of every individual extension.
Thank you for contributing! Contributors, please note the following:
– By contributing to this repo, you agree that your contribution could also be published at PopClip Extensions.
– I will choose which extensions to publish at my sole discretion, and that i may sexy petite blondes make changes to any extension.
– Don’t fret about signing the extension. I’ll take care of that.
For a straightforward technique to create certain varieties of extension with no coding necessary, check out Brett Terpstra’s PopMaker app.
Listed here are some external “easy methods to” guides for creating extensions:
Create Your individual Custom Extension for PopClip (Tuts+)
PopClip: Scripting Extensions (Tuts+)
These instructions are designed to assist a technically competent person to create their own PopClip extension. Please note that user-created extensions should not an officially supported part of PopClip. You must be comfortable with creating and editing plist files, scripts, and so on.
I reserve the best to change or remove features in future versions of PopClip at any time.
By default, PopClip will display a warning dialog when you try to put in your personal extension, because it isn’t digitally signed by Pilotmoon Software.
If you discover this gets annoying while you’re testing your work, you possibly can turn off the warning. Run the following command at the Terminal, then Quit and restart PopClip:
Please remember that PopClip extensions can contain arbitrary executable scripts. Watch out concerning the extensions you create, and be wary about loading extensions you get from someone else. Proceed at your personal risk.
Extra Debugging Output
To help you when debugging Script extensions, PopClip can be configure to write script output and debug info to the console. To enable it, run this command in Terminal:
Kinds of Actions
There are five main sorts of actions supported by PopClip extensions.
All extensions have access to the next filtering mechanisms, to help prevent them appearing when they aren’t useful:
– Filter by matching a regular expression.
– Filter by application (either include or exclude).
– Filter by whether cut, copy or paste is out there.
– Filter by whether the text contains a URL, email address or file path.
Anatomy of a PopClip Extension
About .popclipextz files
For distribution on the PopClip Extensions page, extensions are zipped and renamed with the extension .popclipextz. You can examine an existing PopClip extension by renaming it with a .zip extension and unzipping it, to reveal a .popclipext package.
The .popclipext package
A PopClip extension consists of a property list called Config.plist, plus (optional) additional files such because the icon and any required scripts, all contained in a directory whose name ends with .popclipext. Such a directory will likely be treated as a package by Mac OS X. To view the contents of a package, right click it in Finder and choose ‘Show Package Contents’.
When you double-click a .popclipext package, PopClip will try to load and install it. PopClip stores its installed extensions in ~/Library/Application Support/PopClip/Extensions/.
Here is an example package structure, using the ‘Say’ extension:
Every extension must contain a Config.plist file. This should be in Apple Property List format. The plist contains information concerning the extension, and likewise defines one or more actions. You may generate a blank plist with Xcode or a dedicated plist editor akin to PlistEdit Pro. Alternatively, use one of the present extensions as a basis and edit with a text editor
Example plist: ExampleConfig.plist.
Here is an example plist for ‘Translate Tab’, as viewed in Xcode:
Extensions may include icons to represent actions. The icon is displayed within the PopClip popup itself, and also in the preferences window and on the internet site (if published). Icons could also be created in any graphics program; I exploit Pixelmator.
For best results, the icon ought to be a square PNG file a minimum of 256×256 pixels in size. The image should consist of a black figure on a transparent background. You should use opacity to achieve ‘shades of grey’.
For instance, here is the total-size icon file for ‘Sort’:
– All key names are case sensitive.
– Just remember to set each field the correct type. A typical error is to enter a number as a string type.
“String or Dictionary” type
Fields with the kind “String or Dictionary” can take either a String or Dictionary value. If you supply a string value, that string is always 4pcs/pack Virgin Indian Straight Weave Pure Human Indian Human Hair Natural Color used. Alternatively, you possibly can supply a dictionary mapping language code (en, fr, etc.) to a string. PopClip will display the suitable string for the user’s preferred language if possible, with fallback to the en string.
Common reasons for malformed XML are:
– Missing end tags
– Mismatched start and end tags
– Unescaped & characters (& should be endoded as &)
The Config.plist file has the following structure.
Each action dictionary has the next structure. Exactly one in every of Service Name, AppleScript File, Shell Script File, URL or Key Combo must be specified.
These are the values supported by the requirements field. Additionally, you possibly can prefix any requirement with ! to sexy petite blondes negate it. For example, !paste in case you only want the action to seem when Paste isn’t available.
Before and After keys
These are the values supported by the Before and After fields.
Options are presented to the user in a preferences window and are saved by PopClip’s preferences on behalf of the extension. Each option dictionary has the next structure.
These strings are available in Shell Script and AppleScript extensions. Where no value is out there, the field will likely be set to an empty string.
Only one among Bundle Identifier or Bundle Identifiers is required, not both.
Example AppleScript File
Important: AppleScript files have to be in UTF-8 plain text format. (Save as ‘text’ format in AppleScript editor.)
Here is an example of an AppleScript file for use in an extension (this one is for sending to Evernote):
Example Shell Script File
Here is an example of an shell script to be used in an extension (this one is for ‘Say’):
Script Returning Result
Scripts can return results if they specify one of the *-result or show-status keys within the Action’s After field.
Scripts should indicate success or failure as follows. If the script indicates a failure with settings, it’ll cause the extension’s options window to seem (if it has one).
Here is an example of a Ruby script that may very well be utilized in a shell script extension (with the Script Interpreter set to /usr/bin/ruby) and the After key set to paste-result.
See also the Uppercase extension for a working example.
Key Code format
Key presses must be expressed as a dictionary with the next keys:
Note: Exactly one of keyChar or keyCode should be specified. Not both.
sexy petite blondes