Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

folder action not working mountain lion

Hi I am trying to get Folder Action to work... Even if action is attached to a folder as shown below nothing happens when files copied to "programming" folder?


User uploaded file

MacBook Pro with Retina display, OS X Mountain Lion (10.8.1)

Posted on Aug 24, 2012 6:20 PM

Reply
Question marked as Best reply

Posted on Sep 1, 2012 5:22 AM

I am facing the same issue...even a simple alert script is not getting triggered 😕

41 replies

Aug 9, 2013 11:54 PM in response to KindnessIsNiceDuh -K.I.N.D.-

As I just now found out from http://hints.binaryage.com/change-the-file-location-of-screenshots-on-mac-os-x/


The thing that I was talking about related to the plist catching or something, can be solved simply by typing this command into the terminal:


killall SystemUIServer


If you read the post above, I believe this command line will be the same as (or better than) shutting down the entire computer. But Please Please Please make sure to save any open files before running that command, since it may close your programs.


Shout out to red_menace for pointing out the page where I read this tip. Thanks 🙂

Aug 16, 2013 3:56 AM in response to Boby51

HI guys, I read a recent post on this thread concerning workaround and fixes to the original issue of applescripts with handlers on adding folder items to ... after receiving ("FolderActions not working" or in other cases NOT responding or erratically responding / stalling , or performing erraticlly or generally problematic when invoked under OSX 10.8.x to folders.


From my research, diagnosis and experimentation I have resolved a simple procedure and change to the method of implementing FOLDER ACTIONS on OSX 10.8 and beyond, that does NOT involve directly adding FOLDER action scripts through the FINDER and also NOT the "ADD FOLDER ACTION" service or the applescript directive eg


attach action to (action_01_folder as string) using (script_01 as string) -- attach the folder action script to the folder


Here's why

... and what you might try before reaching for a welder, a hammer and a scalpel (and many other things in this thread and many others in these forums) to perform some kind of low level change to stage information parms. You definately DONT need to.... 🙂


Franky this stuff should work reliably and in fact it does quite well.

Background:

I have several workflows that Ive developed over many years that rely on FOLDER ACTIONS for producing VFX and videos etc. Compressor, , Shake etc that rely on apple scripts that we rely on for production work.


What fails:

you will see a great deal of messages (and strings) for FOLDER ACTIONS in the /var/log such as:

..... 20:12:47 mac-mini-i7 com.apple.launchd.peruser.501[xxx] (com.apple.FolderActions.folders): Throttling respawn: Will start in 7 seconds

... some is "is deprecated " .. etc etc


Symptoms:

Fundamentally your applescripts are slow to repsond/trigger to an adde or removed items and in additoin a long running script completes but will not continue its iteration through a loop (repeat with items in ..) for example. Attempts to trigger it remain allusive other than loggng in and out and then local ~/Library/scripts will be enabled somehow through Launchd and they can be started.

Basically its all erratic.

Remedy/ Solution/ How to fix in MAC OSX 10.8?

1) Use Automator.app FOLDER ACTIONS to add folder actions applescript to a folder.

User uploaded file


2) DONT use the FINDER "add folder actions" service and DONT use the applescript directive "attach action to" in applescript

User uploaded file


3) use Automator to add your applecript to a folder as a "Folder Action" workflow:

  • add you VERY SLIGHLY modified (change the handler) to the "run applescript" workflow node in Automator
  • direct the folder action node to the FOLDER that you want the event/trigger to happer.
  • change the legacy applescript event hander from "on adding folder items to ... after receiving" to the default "on run {list_if_added_items, some_parms} .... .... end run" that is used in the Automator.app "Run Applescript" workflow node.
  • the first paramater thats passed is a LIST of pointers to the items tha were added to the folder. same as usual
  • parmeter 2 is a list of the TEXT script commands code and other details he was passed to this handler...
  • whats missing ?..... add this line of applescript to DERIVE the path of the folder where the folder action workflow is attached: 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
  • simple!
  • User uploaded file


    Why is this better in OSX 10.8 (why I reckon you should try it).

    1. Is well documented (Aple dev doc I recall) and these forums that launchd is the preferred method such several verisons back for kicking over folder action projects. In addition the stability of Automator.app and its interation with launchd is very solid.
    2. It (this) IS very stable and VERY VERY resposive compared with the legacy "on adding folder items to nnnnn after receiving yyyy" handler method as far as I have experienced.
    3. Automator "on run" handler from the Automator setup LAuchagents (see ~/Library/Workflows/Applications/Folder Actions" for these Folder Actions created by Automator.
    4. You wont see any of the "deprecated" call messages in the log unless you have some thing very old and unsupported in your applescript.
    5. you won't see (very much) iterative (loop /repetive contsructs) stop or pause in a long running script (say a transcoder app in a shell (do shell) or such).. the folder action script willcomplete to the end and not stall 🙂


    Errors in Automator Applescripts logged to /var/log:

    1. you MUST develop some kind of external logging and use ERROR recovery "try .. on error .. end try" constructs to catch errors. Else it very very difficult to debug these.
    2. DONT have any carriage returns or "blank lines" at the start of the script else you will get messages such as
  • "AppleScript Runner[nnnn]: Incorrect NSStringEncoding value 0x8000100 detected. Assuming NSStringEncodingASCII. Will stop this compatiblity mapping behavior in the near future." or
  • "AppleScript Runner[nnnnn]: CPSGetFrontProcess(): This call is deprecated and should not be called anymore."

  • Summary:

    This approach to using Automator.app to develop FOLDER ACTIONS workflow nodes on folders is very stable and very responsive compared to the legacy method.

    We've converted all our workflow using FOLDER ACTION applescripts to using this method with 100% success.


    Post your results for others to see.


    Warwick

    Hong Kong

    Sep 8, 2013 2:10 PM in response to Boby51

    A year ago on another system (which has now been migrated from 10.7 to my new one running 10.8), I renamed my user account (short name) from "louis" to "lpfb". I've since created a new Folder Action which deals within my Home folder (~/Downloads) and I find the following error in the console.


    9/8/13 3:24:25.252 PM Folder Actions Dispatcher[288]: AppleEvents failed to encode extension for /Users/louis/Downloads, err=No such file or directory/2


    So my question is...should I try and get these plist files straightened out by using the actions highlighted above? I'm wondering if there's a broken link in there looking for my old home folder?

    Sep 8, 2013 2:30 PM in response to louis_phb

    Hey Louis, if understand correctly what you're trying to do. I think I would suggest trying the following befor you try any of the more intense suggestion on this forum:


    1) Open to your Finder and try to go to ~/Users/louis/Downloads


    2) If that folder doesn't exist, make one yourself. Don't exit the Finder though.


    3) Click on the Apple Logo in the upper left and choose "Force Quit..."


    4) In the pop up window click on Finder and press the "Relaunch" button.


    5) Now right click the Download folder and select "Move to Trash". Go to the trash and empty it, don't use the "rm -r" command in the Terminal. Warning: this will delete everything in the Trash, and everything in the Downloads folder. Make sure you moved anything you want to keep to a safe loation.


    6) After emptying the trash, make sure your Finder is still open to where the Downloads folder used to be, and repeat steps 3 and 4.


    7) Ok everything should be fine now. But if your problem still persists, I would recomend making sure you're wrote everything correctly in you Automator script, or just simply setting your name back to the way it was before.


    Best,

    Vlad:)

    Sep 8, 2013 3:14 PM in response to louis_phb

    Great! 🙂 Glad to hear that.





    The relaunch is basicly a feature spesically designed for the Finder app (you'll notice that all the other apps say "Force Quit").

    All it really does is assumes that if the user pressed it then "something must be wrong," so it closes the Finder and reopens it. The key is that when it reopen the Finder, it doesn't use the plist copies from virtual memory, but rather it goes to the actuall .plist files on the harddrive and loads from those.


    The reason this helps, is sometime the OS or some app makes a change to the .plist files but forgets to update their copies in the memory. This can cause issues like you were having, where the computer thinks a folder still exists even though it really doesn't. Refreshing the finder forces the computer to use the most resent versions of the .plist.


    Or at least that's the way I see it...



    Hope that was an ok explination 🙂

    Bye,

    Vlad

    Sep 26, 2013 3:24 PM in response to Warwick Teale

    Does anyone know how I would accomplisht the following?


    Create an "application" using applescript or automator that would do the following:

    User double clicks "application"

    User is asked to select folder

    User selects folder

    Any images dropped into that folder would be scaled to specified pixel site. This should take place for life (or until user removes folder action from folder)

    It should also apply to the subfolders if any are created to that folder.


    I tried do it on automator and it didn't work.

    The folder is empty at the start and it gives me an error. It works on folder action.


    Any help would be greatly appreciated!

    Sep 26, 2013 4:18 PM in response to Ohms238

    I'm not sure about first three requirnments:

    User double clicks "application"

    User is asked to select folder

    User selects folder


    But the rest of it sounds like they should be a pretty simple folder action.

    Although, I'll be honest, I looked the other day and I didn't see a photo resize option in the Automator.


    I would suggest though that you start a new thread about it since this is a little "off topic". You'll probably get more help that way.


    Once you start that thread, please either private message me or post the link to it on here since I have serval suggestions that I think will work well for you.

    Jan 16, 2014 9:31 AM in response to KindnessIsNiceDuh -K.I.N.D.-

    I had the problem with folder actions for 5 years now - and I bought a new iMac a year ago. The problem seemed to be migrated with my user account to the new machine.


    Anyway, after a lot of tests, I just found a solution which worked for me. I made some experiments with the files and folders in the $HOME/Library folder. And I found that the solution was to simply delete $HOME/Library/LaunchAgents. After a reboot, folder actions were working - and this was really a great success at the end of all my tries.


    Hope, this helps anybody.

    Mar 11, 2014 4:33 PM in response to Magictom42

    Magictom42 wrote:


    ... the solution was to simply delete $HOME/Library/LaunchAgents ...


    Sounds pretty reasonable, but I would highly recommend that you save a zipped file of any system related folder/file you delete. I do similar things all the time, but I always make a zip of it before deleting, and keep the zipped file in the same folder as the original so it be easy to find if I destroy my computer on accident 😉.

    Mar 11, 2014 4:41 PM in response to Magictom42

    Also, my LaunchAgents folder seems to have a lot of other important stuff in it, so perhaps deleting the whole folder might not be a good idea, unless those files are just auto-regenerated on system startup. I would recommend only deleting the files you think are causing the problem.


    But either way, I would still suggest saving the whole folder in a zipefile before messing with it. 😀

    folder action not working mountain lion

    Welcome to Apple Support Community
    A forum where Apple customers help each other with their products. Get started with your Apple ID.