Skip navigation

Why doesn't Folder Actions just work? That would be so much easier!

2599 Views 12 Replies Latest reply: Aug 22, 2013 8:20 AM by Warwick Teale RSS
Kawanaut Level 1 Level 1 (50 points)
Currently Being Moderated
Nov 16, 2010 1:50 PM
I've spent the last 3 hours reading online, trial & error and swearing.... all I want is for a Folder Action to import pictures into a hot folder, into Aperture.

I tried the "Aperture Hot Folder" app but some say it doesn't work with JPEG files, only RAW files, some says it works with both. For me, it only works if I drag a file into my hot folder, whatever my Eye-Fi card places there, it doesn't care about.

So I wanted to achieve the same with Folder Actions by Automator. Should be simple, but it doesn't work. All that console gives me, is this:

16/11/10 22.45.59 com.apple.launchd.peruser.501[213] (com.apple.FolderActions.folders) Throttling respawn: Will start in 9 seconds

... and then nothing happens.

A few times, I actually managed to get the Folder Action to import a JPG file that I dragged into the folder, but eventually it just stops working and there's nothing I can do about it.

I'm quite sad that I spent over $100 on an Eye-Fi card now that I can't "tether wireless" as I wanted to, now I manually have to import the images into Aperture to do stuff with them.

Bad Apple!
MacBook Pro 15" Unibody, Mac OS X (10.6.4), iPhone 4
  • backlon Calculating status...
    I've been struggling with folder actions on image import from my camera for over a month. Changing the time on my camera so that it was several hours before the time on my computer immediately fixed my issue.

    I was really struggling because things worked fine when I tested them on the east coast only to fail massively when I really needed them to work in a liveblog .....on the west coast!

    Thanks!
    Macbook Air, Mac OS X (10.6.6)
  • Loren Ryter Level 2 Level 2 (495 points)

    I'm still looking for a solution to misbehaving and/or not working Folder Actions.  Sometimes it works, but most of the time it does not.  When it does not it seems not to for days or weeks and persist in the broken state across reboots.

     

    I also get throttling respawn messages in the console.

     

    Here is thread I started on this, now locked.

     

    The best answer pointed at some "hidden force" changing an "OnDemand" key from true to false in one of the associated launchd plist files.  Unfortunately changing it to true manually, as well as altering the permissions as described, did not do the trick for me.

     

    Another thread I found elsewhere pointed to an issue with .DS_Store files, and suggested that if your attached script deleted them at the end, "throttling" problem would go away.  Unfortunately i haven't even been able to get it working to test this. 

     

    Very frustrating.  Can anyone suggest a working 3rd party replacement for folder actions?

     

    This thread suggests rolling your own -- but you can't pass arguments about adding files.

  • Warwick Teale Level 3 Level 3 (555 points)

    Hi K, i dunno if you have resolved this...assuming your applescript you attached to your folder is OK and has not developed run time errors.... then try this

     

    , try this link I just posted. If your former applescript folder action was rock solid then became erratic and unpredictable in OSX 10.7 or 10.8, you simply need to attach an AUTOMATOR "folder ACTIONS" workflow node to the folder.

     

    The Automator.app's "folder action" "run applescript" workflow node contains 99.% of your original applescript you use current.

     

    You just need to change the handler.. so simple.

     

    see this link I just posted .https://discussions.apple.com/thread/4237919?start=30&tstart=0

     

     

    Post your results for others to see.

     

     

    Warwick

    Hong Hong

  • Loren Ryter Level 2 Level 2 (495 points)

    Interesting, thanks. I've since set up watch folders with launchd running applescripts directly. A bit more tedious, but more reliable.  Your automator method seems plausible, but also adds another layer.

  • Warwick Teale Level 3 Level 3 (555 points)

    Hi Loren thanks for the reply. I don't believe it technically adds another layer. It's a less complex and far more reliable and sandboxed method of overcoming the erratic behaviour of folder action apple scripts that were enabled in the pre 10.6 launchd era

     

    More so, there's certainly no need to modify XML parms in the underwear to change time intervals etc etc

     

    My point to those who are experiencing this erratic behaviour issue is that the use of the "run AppleScript" Automator node to attach to a folder action workflow is very solid, responsive and seemingly efficient. Btw you can actually see the workflow running and cancel it using the menu bar icon

     

    What I missed adding in the set up procedure is that folder action scripts should be first detached (removed) from the target folder. In fact that services UI to do this is not do good and buggy compared to the clean Automator.app UI

     

    Anyway we are certainly happy with this. We have a lot if folder action triggered work flow

     

    Again Thanks for you reply!

    W

  • skiatomic08 Calculating status...

    warwick, help me out here.

    this is what you said i was supposed to run as an apple script in automator, right?

    i'm getting the following error message..

     

    Screen Shot 2013-08-22 at 8.37.13 AM.png

     

    please help me out here! i've been trying to figure this out for days

  • Warwick Teale Level 3 Level 3 (555 points)

    Hi Skiatomic.. strange.. how are RUNNING this workflow? IT WONT work if you are trying to run this form the AUTOMATOR. UI?? looks like you are.

     

    Here try this TEST code and do the following:

     

    on run {list_of_added_items, automator_call_parameters}

              do shell script "logger " & "\"" & "*** Msg001 - Folder Action Entered ***" & "\"" -- log this to master console


              tell application "System Events" to set my_hot_action_folder to the path of the container of the first item of list_of_added_items as alias


              do shell script "logger " & "\"" & "*** Msg002 - Folder name path is [" & my_hot_action_folder & "] " & "\"" -- log this to master console

              do shell script "logger " & "\"" & "*** Msg003 - The 1st object just added is [" & the first item of list_of_added_items & "] " & "\"" -- log this to master console


      -- you existing applescript folder action script goes here

      -- add your error recover also and anything you use to log the status and progress - it all works!

    end run

     

     


    Step 1: for a TEST so see of your folder action woks. you will need some kind of event trace. Because this is a BACKGROUND process , you can use the unix "logger" function to log messages to the master log /var/logs. The applescript source lines above that begin with " do shell script "logger " & "\"" .. get some of the local variables including the one tha thas "failed" when u ran this, and formats a simple message that appears in the console log (see later.

     

    so paste the above code into your apple script and then SAVE the automator workflow.

     

    step 2: drop/add something to your "New Downloads" folder where this (your) FOLDER action workfloe is attached.

     

    step 3: with 2-3seconds patinece, OPEN up the /applications/utilities/console.app and click on the Syetem Quries then All MEssages.. and scroll down to teh end.... and viola you will see these 3 lines logged.

     

    22/8/13 9:20:36.557 PM coreaudiod[189]: Enabled automatic stack shots because audio IO is inactive

    ........ snip snip ....

    22/8/13 9:20:36.575 PM warwick[27370]: *** Msg001 - Folder Action Entered ***

    22/8/13 9:20:36.583 PM warwick[27371]: *** Msg002 - Folder name path is [Macintosh SSD:Users:warwick:Desktop:actionaction:]

    22/8/13 9:20:36.589 PM warwick[27372]: *** Msg003 - The 1st object just added is [Macintosh SSD:Users:warwick:Desktop:actionaction:a_pdf_for_skiatomic08_test.pdf]

     

    here is what those code does... (See above logg messages).. I just did thos for ya.. so it works fine.. at least here in Hong Kong

     

    yep it works great.

     

    I think you issues is that you are TRYING to run your folder action from the AUTOMATPR "RUN" UI.. this doesnt make sense if you thing about it.

     

    Try this and then use this code stub to make your own script tracer/logger. You can redirect this to a FILE rather than /var/log. If you do a reasonable amount of scriting for background processes, you will need to develop some kind of RYO trace or logger for these errors.

     

    Let us all know this helped by clicking in the icons in the forums. This allows others to see any resolutions.

     

    Post your results for others to see.


    cheers mate!
    warwick

  • skiatomic08 Level 1 Level 1 (0 points)

    thanks for writing this out for me

    i'm going to try the test as soon as i get to my computer

     

    what i'm trying to run is a Folder Action that is triggered by a folder called New Downloads (a folder where tv and movie downloads go to)

    once a tv file is added, i want it to go to TV Downloads

     

    so my setup is this:

     

    Folder Action receives files and folders added to New Downloads

    1. Geet Specified Finder Items [from New Downloads]
    2. Get Folder Contents (repeat for each subfolder found)
    3. Filter Finder Items [Kind is Movie, Size is <350MB, Name does not contain 'Sample']
    4. Run AppleScript (this is basically a 'Stop if Input is Empty' script so that there aren't any errors if it runs and there aren't any files)
      • on run {input, parameters}
            
          set currentAction to index of current action of front workflow -- the most recent completed action
          if input is {} then -- if no input then disable the following action
            tell Automator action index (currentAction + 2) of front workflow to set enabled to false
          else -- enable it
            tell Automator action index (currentAction + 2) of front workflow to set enabled to true
          end if
            
          return input
        end run
    5. Move Finder Items [To: New TV Shows]

     

    I have no errors and it works perfectly fine inside of automator. But the Folder Action never runs when files are added to the trigger folder. Bugging the crap out of me.

  • skiatomic08 Level 1 Level 1 (0 points)

    so after running the test, i only got the 1st message

     

    Screen Shot 2013-08-22 at 10.29.47 AM.png

     

    this is what the applescript looks like in automator

    Screen Shot 2013-08-22 at 10.30.31 AM.png

     

     

    any idea what could be causing this?

  • Warwick Teale Level 3 Level 3 (555 points)

    Hi Brad.. on the surface.. it seems that you DONT need to run an APPLE SCRIPT to do what you want. Merely construct your FOLDER ACTION WORKFLOW from the available worklow NODES on AUTOMATOR.

     

    The applescript in the RUN APPLESCRIPT node is probably making what you do cumbsersome and your experience over complex and difficult.

     

    You should be able to achieve what you want to do by the availalble Automator workflow nodes. You will need a list of what you think are VALID OBJECT 'KINDS" that are movie content. THere are MANY you need to cater for from the obvious QUICKTIME to MATROSKA.. and a long lost.U van pass tose as a VARIABLE list to  one of your nodes....

     

    You can use the FINDER 'Kind" propertiy to see what is a vide/movie object... and discard the rest.

     

    Whatever you do DONT relay on the silly legacy "dos" file suffix.. use the object "kind" known to the finder...

     

    w

Actions

More Like This

  • Retrieving data ...

Bookmarked By (1)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.