Jump to content

DerNils

Member
  • Posts

    7
  • Joined

  • Last visited

Reputation Activity

  1. Like
    DerNils got a reaction from Misha in Opening folders from File Search in Commander One instead of Finder   
    Well, CO does not completely replace Finder. It's an alternative application. 
    I was hoping that Alfred would have an option somewhere to open the found folder of File Search with another app than Finder....
  2. Like
    DerNils reacted to deanishe in Evaluating the result of a bash script   
    The Post Notification action has a handy "Only show if the input has content" option. You can use that to "filter" the error message without having to set variables or use Filter objects.
     
    Basically, anything your code prints to STDOUT is passed as input to downstream actions, while anything sent to STDERR ends up in Alfred's debugger.
     
    So, the simplest way is to check the exit status and if it's non-zero, just echo your error message. As long as all the other output is redirected elsewhere, the notification won't be shown unless there's an error.
     
    This is from a simple workflow I wrote to eject and trash mounted disk images:
     
    log() { echo "$@" >/dev/stderr } log "name=$dmgname, mount=$dmgmount, path=$dmgpath" # unmount out="$( hdiutil detach "$dmgmount" 2>&1 )" hds=$? if [[ $hds -ne 0 ]]; then log "hdiutil exit status: $hds" log "$out" echo "$out" exit 1 fi # trash disk image out="$( osascript -e "tell application \"Finder\" to delete POSIX file \"$dmgpath\"" 2>&1 )" oss=$? if [[ $oss -ne 0 ]]; then log "osascript exit status: $oss" log "$out" echo "$out" exit 1 fi log "trashed $dmgpath" echo "Unmounted and trashed" That script is connected to a Post Notification, which will either show "Unmounted and trashed" if everything went okay, or the output from hdiutil or osascript if one of them failed.
     
×
×
  • Create New...