Jump to content

adayzdone

Member
  • Posts

    27
  • Joined

  • Last visited

Posts posted by adayzdone

  1. I understand you can use a script filter to display 3 results and use the selected result to pass arguments to a script afterwards.

     

    Is it possible to use 3 seperate keywords to pass hard coded argument to a script directly?

     

    I am trying to avoid using two steps (keyword & resulting list) to select the workflow's parameters.

  2. Each application can define its own scheme (if the programmer chooses to do so).

     

    Hi Shawn,

    Thanks for the reponse. How do you find which applications support a scheme, and if so, what it is?

     

    I am trying to create a custom action for Contacts that is triggered by the Notes field. However, rather than just sending the value of the Notes field, I want the First and Last names as well.... or at least a reference to the contact so I can parse it myself.

  3. Can someone point me to the documentation for "Pass to URL Scheme"? What values can you preface the query with?

     

    I am trying to pass both the value of the notes field along with the contact's First and Last names. Is this possible?

  4. Quick question: the <item arg=“"> should be removed completely in order to use <arg></arg>? Or Alfred will use <arg></arg> if set and ignore the other (no need to remove the other for good)?

     

     

    I am confused. Starting with...

    <item uid="rdioartist" arg="r96664" valid="yes" autocomplete="Incubus">

     

    Which is the recommended format to exclude uid ?

    <item uid="" arg="r96664" valid="yes" autocomplete="Incubus">

    <item arg="r96664" valid="yes" autocomplete="Incubus">

     

    When would you use <arg></arg> ?

  5. The Voice Search Workflow opens Google's search page in Chrome and activates the voice search. Upon a successful search, search terms are copied to the clipboard.
    aqnXiLb.png5c585xj.png
    Download
     
    Usage: Call the Voice Search workflow with the vs keyword.
     
    Version: 1.2
    Release date: 2013-05-16
    Author: John Day

    Version History:

    1.2 Opens new tab if current tab is not Google Search
    1.1 Copy Search Term to Clipboard
    1.0 Initial Release
     
    Dependencies:
    Google Chrome must be installed.
     

  6. Try:

    try
        
        set query to "{query}" as number
        set base_em to 16
        set calculated_em to query / base_em
        set the clipboard to calculated_em as text
        
    on error errMsg number errNum
        tell application "Finder"
            activate
            display alert errMsg & return & return & "Error number" & errNum buttons "Cancel" cancel button "Cancel"
        end tell
    end try
  7. Thanks, but I'm finding that hard to follow without a basic explanation of the technique.

     

    I have posted an example of how to Generate Feedback in Alfred 2 Workflows

     

    From the Script Filter you can call the AppleScript with:

    osascript xml.scpt "{query}"

    To accept the query in the AppleScript, use:

    on run argv
    set query to argv as text
    end run

    Note that argv is a list and may cause problems if you don't convert it to text first.

  8. The  EXIF Data Alfred Workflow uses Exiftool and mdls to quickly display metadata in Alfred.

     

    Version: 1.0
    Release date: 2013-04-21
    Author: John Day
    Original Release Page : http://www.johneday.com/831/exif-data-alfred-workflow

    Download

     

    Usage:
    Select a file and call the EXIF Data workflow with the et keyword. Map the four Hotkeys to bypass the main menu and execute options directly.

     

    jed125.png

     

    Select an item from the View in Alfred option to copy the tag’s information to the clipboard.

     

    jed126.png

     

    Select one or multiple items from the Choose from list option to copy the tag and its information to the clipboard.

    jed127.png

     

    Select the Export to file option to save metadata to a text file in ~/Documents/metadata/ using ExifTool. One or multiple files may be processed with this option. If the selection is not a supported file type, you are given the option to use mdls to view available information.

    jed128.png

     

    Select the Export mdls to file option to save metadata to a text file in ~/Documents/metadata/ using mdls. One or multiple files may be processed with this option.

    jed129.png

     

    System Modifications:
    A metadata folder is created in Documents to archive the text files created by the Export to file and Export mdls to file commands.

  9. This workflow demonstrates several feedback scenarios and can be used as a template for your AppleScript projects. I will maintain an updated copy of this post on my blog: http://www.johneday.com/617/generate-feedback-in-alfred-2-workflows

     

    feedback.png

     

    Overview:
    To generate feedback in Alfred, we use a Script Filter to pass a query to the xml.scpt AppleScript. The script then processes the query and returns a properly formatted XML string containing information for each item to be displayed. After you import the Generate Feedback workflow, launch it with the gf keyword to view my five examples. To reveal the xml.scpt you will need to edit, open the gf Script Filter and click the Open workflow folder button at the bottom of the window.


    Basic Usage:
    Add each item you would like to be displayed in your workflow to the itemList by passing a record containing the required labels to the xmlItem handler. For an in-depth description of each attribute, I have included pieces of David’s tutorial in the script’s comments.

    on run argv
        -- coerce the argv list to text
        set query to argv as text
     
        -- create an empty list to hold the items
        set itemList to {}
     
        -- Feedback item 1
        set end of itemList to xmlItem({uid:"My uid", arg:"My arg", title:"My Title"})
     
        -- Wrap the elements of the list with a declaration and return the list to Alfred
        return giveFeedback(itemList)
    end run
    

     

    xmlItem Handler
    Required labels:

    {uid:"My uid", arg:"My arg", title:"My Title"}
    

    Optional labels:

    subtitle:"My Subtitle"
    valid:"no"
    autocomplete:"Autocompleted text"
    icon:"icon.png"
    icon:"public.plain-text", iconAttribute:"filetype"  -- iconAttribute must be used with icon
    icon:"/Applications", iconAttribute:"fileicon"       -- iconAttribute must be used with icon
    

    Advanced Usage:
    Characters < > & " need to be escaped properly for XML. To insert items that may contain these characters, pass the string to the clean handler along with a true/false value to remove leading and trailing whitespace.

    clean("     Title with leading whitesplace & < > \" characters, trimming true", true)
    

    Alfred uses the uid attribute to learn which results are selected the most and then uses this information to sort your feedback. If you would like to manually arrange the returned items, use the uuid handler to generate a unique uid. In Alfred’s next release (after 2.0.2), this issue will be resolved and the item UID attribute will be optional.

    uid:uuid()
    

    Along with the workflow, I have included a list of file types that may be used as values for the icon label when paired with iconAttribute:”filetype”. See http://imgur.com/a/0zXVX for the corresponding icons.

×
×
  • Create New...