Jump to content

How to automatically pass the output file of a workflow back into Alfred?


Recommended Posts

I'm trying to replicate some functionality where I can trigger a screen capture using Alfred and then have the resulting file get piped back into Alfred as the selected result so that I can further operate on it e.g. email, rename, share, etc..

 

Desired flow:

  1. Open Alfred and trigger screen capture tool
  2. Take Screenshot
  3. Re-open Alfred with the screenshot file already selected

 

I've tried a number of different screen capture workflows (Screencapture, Various Screenshots, etc..) but haven't come across any that can do this.

 

Tony

Link to comment
1 hour ago, Alfred0 said:

have the resulting file get piped back into Alfred as the selected result so that I can further operate on it e.g. email, rename, share, etc..

 

Use Alfred’s browse AppleScript command (tell application id "com.runningwithcrayons.Alfred" to browse "/path/to/your/file") to select a file in Alfred, or the action command to go straight to File Actions.

Link to comment

Awesome, thx @deanishe!!

 

Now I just need to figure out how/if it's possible to add this AppleScript after this bash script is run?

 

I'm using the "alfred-various-screenshots" workflow, and I've created an issue in this repo as well, but any pointers/tips would be appreciated for this workflow or any other screenshot workflow to be honest 😁

 

DefaultLocalScreenshotFolder="${DefaultLocalScreenshotFolder:-$HOME/Desktop}"

# Expand ~, since it not works in Alfred
#
DefaultLocalScreenshotFolder=`echo "$DefaultLocalScreenshotFolder" | perl -pne 's/^~/$ENV{HOME}/'`

readonly filename=`date '+screenshot_%Y-%m-%d_%H-%M-%S.png'`
readonly filenamepath="$DefaultLocalScreenshotFolder/$filename"

if [ {query} = "area" ]; then
    screencapture -is "$filenamepath" >/dev/null 1>&2
elif [ {query} = "window" ]; then
    screencapture -iW "$filenamepath" >/dev/null 1>&2
else
    screencapture -S "$filenamepath" >/dev/null 1>&2
fi

if [ $? -eq 0 ]; then
    echo "OK"
fi

 

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