AppleScript Types

From Quicksilver Wiki
Jump to: navigation, search


As described in AppleScript_Actions, you can indicate what types your applescript accepts using the get direct types and get indirect types handlers. You can use Quicksilver Types or Apple UTIs as described below. They are also described as simple strings.

get direct types Use this handler to return a list of valid object types for which your AppleScript action will appear

get indirect types Use this handler to return a list of valid types that you want to appear in the 3rd pane for your AppleScript action. Note that for the 3rd pane to appear for an AppleScript action, you must implement the get argument count handler. See the AppleScript Actions page for more information.

Quicksilver Object Types[edit]

These are some of the Quicksilver object types that can be used.

Type Description
"NSFilenamesPboardType" Files and folders
"NSStringPboardType" Text or a string
"Apple URL pasteboard type" URLs
"QSFormulaType" Formulas as used by the Calculator Plugin
"qs.process" Running applications or processes
"qs.command" Quicksilver command
"QSRemoteHostsType" Remote hosts (from the Remote Hosts Plugin)
"" iTunes tracks (indexed by the iTunes Plugin)
"ABPeopleUIDsPboardType" Address Book / contacts (requires plugin?)

Other Quicksilver Object Types[edit]

There are other Quicksilver types that are not listed above, unfortunately there is no way in Quicksilver to get the full list of types. There are three current ways to find out more types:

  • Look through the Info.plist the plugin under QSObjectHandlers (here is an example Info.plist for the Evernote plugin)
  • Build your own debug build which has the "log object to console" action as described in this thread and Building_Quicksilver
  • Ask on the forum

Also see (#1817] which is a feature request to get the current object types.


You can also indicate Apple Uniform Type Identifiers as argument types. Items will match when they represent files that are that UTI type. See Uniform Type Identifiers for a list of the main UTIs (OSX applications can define additional ones). Some examples are:

  • - Application bundles
  • public.mp3 - MPEG-3 audio
  • public.folder - A plain folder (that is, not a package).


Specify the objects for which an action displays[edit]

If you would only like a certain AppleScript action to display for URLs and Text, you would add the following code to your AppleScript:

on get direct types
     return {"Apple URL pasteboard type", "NSStringPboardType"}
end get direct types

Specify the 3rd pane object types[edit]

For a given AppleScript action, if you only want files to appear in the 3rd pane, you would use the following code:

on get indirect types
    return {"NSFilenamesPboardType"}
end get indirect types

Note that the difference between this and the first example is the use of indirect as opposed to direct

A real live example[edit]

A handy AppleScript for creating short URLs can be found on the Shorten URL (AppleScript) page. It makes sense to only have this action available for URL objects, instead of all text objects (which is the default for the on process text handler. In order to achieve this, you would modify the (first) script to be as follows:

using terms from application "Quicksilver"
        on get direct types
                return {"Apple URL pasteboard type"}
        end get direct types

        on process text theURL
                set shortURL to do shell script "curl -s -H 'Content-Type: application/json' -d \"{\\\"longUrl\\\": \\\"" & theURL & "\\\"}\" | awk '/\"id\":/{print substr($2, 2, length($2)-3)}'"
                return shortURL
        end process text
end using terms from