Jump to content

jdfwarrior

Member
  • Posts

    2,028
  • Joined

  • Last visited

  • Days Won

    55

Posts posted by jdfwarrior

  1. Several people have mentioned that Applescript's don't work in the first beta of Alfred 2. The Applescript support IS there, it just hasn't been finished. At it's current state, to use Applescript, the code MUST be wrapped. See example below.

    on alfred_script(q)
         tell application "Finder" to activate
    end alfred_script

     

    It has to be wrapped with alfred_script in order to work at this point. For further examples, see my Rdio workflow that has already been posted. It uses Applescript to control the local Rdio application.

  2. Not really following what you're asking to accomplish.

     

    With the multiple results, you could set them as invalid and set the autocomplete flag so that when you try to action it, it will fill Alfred's input with the value that you want then edit it there and then use a modifier key to send it to another script for working with it.

     

    If it's that you are wanting to pass multiple values through Alfred, which is what it sounds like, you could pass all the data you need through the arg value with some form of delimiter then split it up when it goes through the next step.

     

    Does that make sense?

  3. The Format

     

    ** This will be an evolving document. Check here for updates and new documentation. **

     

    There is also an XML format example available in Alfred 2 preferences. To see it, open Alfred Preferences, navigate to Workflows. Click the + i nthe bottom right corner of the installed workflows list, select Examples->Script Filter XML format.

     

    Result feedback is generated by returning an XML string back to Alfred from a Script Filter item in your Workflow. Script Filters are the only way to pass feedback to Alfred. The following is an example XML string that would be returned to Alfred.

    <?xml version="1.0"?>
    <items>
      <item uid="rdioartist" arg="r96664" valid="yes" autocomplete="Incubus">
        <title>Incubus</title>
        <subtitle>Artist</subtitle>
        <icon>rdio-artist.png</icon>
      </item>
      <item uid="albumart" arg="/Users/user/Documents/album.jpg" type="file">
        <title>Incubus Album Art</title>
        <subtitle>Album Art for Science</subtitle>
        <icon type="filetype">public.jpeg</icon>
      </item>
    </items>

    Results will be returned as a list of "items", with each one being an "item" inside. Each item has several arguments and pieces of information associated with it.

     

    Item Attributes

     

    uid (optional in Alfred 2.0.3+)

    The uid attribute is a value that is used to help Alfred learn about your results. You know that Alfred learns based on the items you use the most. That same mechanism can be used in feedback results. Give your results a unique identifier and Alfred will learn which ones you use the most and prioritize them by moving them up in the result list.

     

    As of Alfred 2.0.3, this attribute is now optional. If no uid is provided, Alfred will simply generate a UUID. This will allow you to maintain a specific order of generated feedback. Previously, the uid (if not unique for each result) would be added to Alfred's knowledge and would be prioritized in later executions.

     

    arg

    The arg attribute is the value that is passed to the next portion of the workflow when the result item is selected in the Alfred results list. So if you pressed enter on the sample item above, the value 'r96664' would be passed to a shell script, applescript, or any of the other Action items.

     

    type

    The type attribute allows you to specify what type of result you are generating. Currently, the only value available for this attribute is file. This will allow you to specify that the feedback item is a file and allows you to use Result Actions on the feedback item.

     

     

    valid ( optional - Defaults to 'yes' )

    The valid attribute allows you to specify whether or not the result item is a "valid", actionable item. Valid values for this attribute are 'yes' or 'no'. By setting a result's valid attribute to 'no', the item won't be actioned when this item is selected and you press Return. This allows you to provide result items that are only for information or for help in auto completing information (See autocomplete flag below).

     

    autocomplete ( optional - Only available when valid = no )

    The autocomplete attribute is only used when the valid attribute has been set to 'no'. When attempting to action an item that has the valid attribute set to 'no' and an autocomplete value is specified, the autocomplete value is inserted into the Alfred window. When using this attribute, the arg attribute is ignored.

     

    Elements

     

    title

    The title element is the value that is shown in large text as the title for the result item. This is the main text/title shown in the results list.

     

    subtitle

    The subtitle element is the value shown under the title in the results list. When performing normal searches within Alfred, this is the area where you would normally see the file path.

     

    icon ( optional - If not icon value is available, the icon will be blank. If the icon element is not present, a folder icon will be used )

    The icon element allows you to specify the icon to use for your result item. This can be a file located in your workflow directory, an icon of a file type on your local machine, or the icon of a specific file on your system. To use the icons of a specific file type or another folder/file, you must provide a type attribute to the icon item. 

    Example: <icon type="fileicon">/Applications</icon> - Use the icon associated to /Applications

    Example: <icon type="filetype">public.folder</icon> - Use the public.folder (default folder) icon

×
×
  • Create New...