Jump to content

simple workflow to reference a static file deployed within the workflow


Recommended Posts

I'm trying to make my work more general (and portable):

 

I have a simple workflow that triggers on the keyword "metro". When running, it simply opens a PDF file of the metro map. It would be convenient if I could put the PDF file in the workflow folder and reference it directly from the plist...

 

Just using the UI, the plist fragment looks like this:

 

<string>metro</string>
    <key>objects</key>
    <array>
        <dict>
            <key>config</key>
            <dict>
                <key>sourcefile</key>
                <string>~/Dropbox/AlfredSync/Alfred.alfredpreferences/workflows/user.workflow.C1A446CC-846E-4FB1-A984-291F4CCAC3CC/metro-map.pdf</string>
            </dict>
            <key>type</key>
            <string>alfred.workflow.action.openfile</string>
            <key>uid</key>
            <string>BF894521-D004-4258-AD1C-3E8AFD4249A5</string>
            <key>version</key>
            <integer>1</integer>
        </dict>...

 

The workflow doesn't seem to accept a relative path from the workflow folder as a "sourcefile" value.

 

Is there a simple way of bundling the PDF (or other file resources I want to open) so that they can be shipped with the workflow?

 

Is this the right way to do it? - (what might be a better way?)

Edited by misterflibble
Link to comment

Is this the right way to do it? - (what might be a better way?)

 

Alfred runs workflow scripts from within the workflow's folder... so if you replace the Open File action with a Script action set to bash with the simple command:

 

open metro-map.pdf

 

This will open the metro map pdf in the workflow's folder, so you can bundle it just fine :)

 

Cheers,

Andrew

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...