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

Select only recent items in finder

I'm trying to set up an automator script that will run only on recently added (or new) items to the directory. Currently, if I add a folder or file to that directory, Automator will execute the action on all of the files, which I don't want. I can't quite figure out a way to do that other than toggle the option to be "date last modified is...", but the smallest increment is one day, not minutes or seconds like I think might work. Ideally, It would only run on a new item, and run only once on that new item for every item that is added. I have very little experience with Applescript, but I can follow directions like a boss! If any of y'all can help me out, it would be greatly appreciated.


Thanks,

Chase


P.S. - this is my first post here, and I don't quite understand the whole "select a community to post to" option. If this is in the wrong place, or there is a better place to post this, please let me know.

iMac (21.5-inch Mid 2011), OS X Mavericks (10.9.5)

Posted on Aug 29, 2015 3:57 PM

Reply
1 reply

Aug 31, 2015 10:37 AM in response to charper01

Here is how to try out what happens with applescript. I've read in the past for "perfect" results, you need to use launchd. With rapid fire folder actions, the GUI version my fail. This was several years ago.


This covers three ways of getting invoked:

1) Debugging

2) from a folder action.

3) file/folder being dropped on app.


(*   
  Demonstration of how dropping files on AppleScript icon works.  Shows how to debug via on run path. Shows items added to folder.  
    
 Save as an Application Bundle.  Don't check anything.  
  
 Shows log statement.  
  
 It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.  
      
For testing, run in the Script Editor.  
    1) Click on the Event Log tab to see the output from the log statement  
    2) Click on Run  
  
  
Author: rccharles  
  
 *)  
  
  
-- Gets invoked here when you run in AppleScript editor.  
  
on run  
    --  debug lines  
    set desktopPath to (path to desktop) as string  
      
    -- here is a log statment.  
    log "desktopPath = " & desktopPath  
      
    -- Be sure to select a file on your DESKTOP.  
    set see to alias (desktopPath & "Picture 1.png")  
      
    -- Simulate dropped items list.  
    set dropped_items to {see}  
      
    common(dropped_items)  
      
end run  
  
  
  
-- Gets invoked here when something is dropped on the folder  
-- Folder actions.  
  
on adding folder items to this_folder after receiving added_items  
      
    common(added_items)  
      
end adding folder items to  
  
  
  
-- Gets invoked here when something is dropped on this AppleScript icon  
  
on open dropped_items  
      
    common(dropped_items)  
      
end open  
  
  
  
on common(dropped_items)  
      
    -- Write a message into the event log.  
    log "  --- Starting on " & ((current date) as string) & " --- "  
      
      
    log "class = " & class of dropped_items  
      
      
    repeat with droppedItem in dropped_items  
          
        display dialog "here is something that we got as input: " & droppedItem giving up after 15  
    end repeat  
      
      
end common

Select only recent items in finder

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