Jump to content

External script not running


Recommended Posts

I'm trying to get Alfred run the following external script:

 

export LC_CTYPE=C
export LANG=C

cd /Users/tim/Desktop/"Remove Annotations"

for file in *.pdf
do
    outname=`sed -e "s/\.pdf$/_.pdf/"<<<"$file"`
    pdftk $file output - uncompress | sed '/^\/Annots/d' | pdftk - output $outname compress
    finalname=`sed -e "s/\_\.pdf$/.pdf/"<<<"$outname"`
    mv $outname /Users/tim/Desktop/$finalname
    echo "$file: done"
done

 

When running in from the Terminal it works fine, but Alfred seems to not do anything. The debugger doesn't say anything enlightening either. Maybe someone else can help me?

Link to comment

When a Workflow doesn’t run, check the debugger as it will give you important clues.


From a cursory glance, issues are that you’re missing a shebang and that you’re calling an external tool (pdftk) without using its full path (Understanding the scripting environment goes into more detail). Fixes are:

  • Make the first line of your script #!/bin/zsh
  • Use the full path to pdftk. Run which pdftk in a Terminal to find out what it is.

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