Jump to content

How do I include an external script file in my workflow?


Recommended Posts

Sorry if this has already been answered; I could not find an answer in the forum.

 

I have a few workflows in which I have embedded scripts (usually python). In a few scripts that I have downloaded from others (mostly to help me learn the tricks of Alfred scripting), I frequently see that the workflow folder, once the workflow has been installed, has additional files in which the scripts are stored.

 

For example, the workflow will use a script filter, but instead of the entire script being embedded in the script filter component itself, the script filter will just be:

   myscript {query}

and the workflow folder, once installed, has a file named, of course, myscript.py (assuming a python script) which contains the program logic. Some of these workflows even have subfolders with utility scripts and the like.

 

How do I create a script filter and add in external files?

 

Thanks.

 

 

Link to comment

Sorry if this has already been answered; I could not find an answer in the forum.

 

I have a few workflows in which I have embedded scripts (usually python). In a few scripts that I have downloaded from others (mostly to help me learn the tricks of Alfred scripting), I frequently see that the workflow folder, once the workflow has been installed, has additional files in which the scripts are stored.

 

For example, the workflow will use a script filter, but instead of the entire script being embedded in the script filter component itself, the script filter will just be:

   myscript {query}

and the workflow folder, once installed, has a file named, of course, myscript.py (assuming a python script) which contains the program logic. Some of these workflows even have subfolders with utility scripts and the like.

 

How do I create a script filter and add in external files?

 

Thanks.

 

To do this, simply browse to that new workflow's folder and drop the file inside. When the script filter executes, any files referenced there should be available since it would be running from that workflows local path. Any file referenced elsewhere would need a full qualified path to it.

 

Edit: Forgot to mention.. Right click on the new workflow in the list to the left and select "Show in Finder" or.. with the script filter properties shown, click the "Open workflow folder" button in the bottom left of the script area to quickly get to the workflow's folder.

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...