Delaying folder action until file creation is complete

I'm trying to create a folder action that takes the output of a bounce from ProTools and then imports it into iTunes. The problem I'm having is that it takes real time (about 20 min) to create the complete ProTools file in the folder, however the script begins to execute immediately, before the bounce is complete. This gives me 1 second of audio garbage.
Is there any way to delay the folder action until the file creation (bounce, upload, transfer, whatever) is done?
Thanks.

V.K. Thanks again for your help. When I look in my folder directory/library/scripts/folder action scripts, I see many scripts for images as well as scripts for closing subfolders, converting to pdf, open - show comments in dialog, and add - new item alert, however I don't see anything that was created recently (i.e. something that was created when I built my Automator workflow (folder action). The closest (to what I am looking for) Folder Action Script could find was "add - new item alert.scpt", which is an existing Apple written script, but this will not really help me. When I created my initial automator script, it created a folder and file and workflow in my homefolder/library/Workflows/Applications/Folder Actions/xxx.workflow, however I cannot open this workflow in applescript. I even tried changing the extension to .scpt. I'm not sure I can accomplish the desired result with Automator alone, but I don't think I am well versed enough in AppleScript. Thanks for your help.

Similar Messages

  • Creating a delay in labview until a c program completes in system exec.vi without using "wait until completeion"

    I want to run two related C programs. The second one reads a text file that the first created. So I need to wait until the first is completed.
    I use "system exec.vi" and I know I can set "wait until completeion" to true, but this way I won't see the screen and the C program announcments. Someone has an idea?

    Hi Dror,
    my idea: just wait for the text file created by the first C program. Check for the presence of this file (maybe using 'list directory') or check for the size of this file...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Folder action - open file in quicktime

    I'm trying to do something I think should be simple, but I can't seem to make it happen.
    I get voicemails as .wav files in email. I'd like to save these to a folder, and have them automatically open up with quicktime player.
    I've verified that I've got folder actions working, as I've tested some of the example scripts for converting files. However, this script fails silently. What clue am I missing?
    on adding folder items to thisFolder after receiving these_items
    tell application "QuickTime Player"
    open file these_items
    end tell
    end adding folder items to
    Thanks for any help!
    - Steve

    My guess is that what you're missing is that these_items is a list therefore you can't open file <list> since you cannot coerce a list to a file.
    (note this is true even if there's only one file - it's a list of one item)
    Ironically, you may be able to:
    open these_items
    since you're not trying to coerce the list to a file (QuickTime Player will look at each item in the list and work it out).
    Alternatively, the typical approach is to iterate through the list:
    on adding folder items to thisFolder after receiving these_items
     repeat with each_item in these_items
      tell application "QuickTime Player"
       open each_item
      end tell
     end repeat
    end adding folder items to

  • Folder actions - copy files AND subfolders

    I cannot seem to get folder actions working in the expected way.  I have no problem creating a folder action that copies files into the target destination folder.
    But if I create a new folder in the source folder (i.e. a subfolder) it does not create that same subfolder in the target. And of course by consequence, does not copy the subfolders files into the target either.
    Can anyone recommend an automator folder action step that I may be missing?  I'd appreciate any feedback, thanks!

    Thanks for offering to help. 
    I'm using automator with the following two steps:
    - first the default step where automator asks for a folder to attach the folder action to. I selected a folder called test input 1
    - second step is the 'copy finder items' step. I designated a named folder 'test output' and selected the checkbox 'replace existing files' (although I know that all of the folders/files that will be placed in the initial folder will be unique
    I just discovered that I pulled a bit of a rookie mistake. I had the target folder open and incorrectly assumed that my script wasn't working. When in fact I needed to close and reopen the window to refresh.
    However...
    After testing this script quite a bit, it seems very inconsistent.  While subfolders to get created, dragging and dropping some files yields a total inconsistency in the results. I have a particular PDF that refuses to get copied to the target via this script in a subfolder. 
    So I guess my updated status is: I have a script that works, but I don't really trust it because it doesn't always work properly.

  • Script Help: Folder Actions - Move files

    Hi,
    So, I'm having some trouble writing a script for a folder action. I basically want the folder to check the file extension of the files that I add to the folder, and if they are music files (mp3, m4a, m4p), to move those files to a different folder. Additionally, is it possible to also move entire folders containing music files to a different folder, instead of just single files?
    Thank you for any help.

    What is your script doing now (note that a name extension does not include the period delimiter)? You can move entire folders, but your folder action script would only pass the items added to the attached folder, not any folder contents. Your folder action script would need to look into any passed folders if you wanted to move them based on their contents.

  • Processing a File (From a Folder Action) Through an AppleScript

    I have a Folder Action enabled which automatically uploads images placed in a folder to a FTP server. It works great when I'm at home on my own network, but if I'm somewhere with a firewall that prohibits connecting to my FTP server (i.e. work) or if I am not connected to the internet, the folder action will still run but my images will never get uploaded.
    I've attached a screenshot of my workflow. The folder action gets the image added to the folder, copies the original to a different folder, and then scales the image down to a smaller size before uploading it. I'm using the upload workflow action from Transmit.
    I figured I could use an AppleScript to check whether or not my computer can reach the ftp server and then wait until it was connected to run the rest of the workflow if it can't reach the server:
    repeat with i from 1 to 86400
        try
            do shell script "ping -o ftp.examplewebsite.com"
            exit repeat
        on error
            delay 5
            if i = 86400 then error number -128
        end try
    end repeat
    The only problem is, I'm pretty inexperienced with AppleScript and am not really sure how or where to insert it into my workflow to get the image to "pass through" the AppleScript. Currently, whenever I include this AppleScript in my workflow, before the Upload action, for example, the image ends up not getting passed through the AppleScript and it doesn't get uploaded as a result.
    Hopefully this a fairly simple question and someone can help me out, or if there's an easier way to delay running a folder action until I can connect to the server someone will let me know. I can clarify anything if necessary.

    Good job
    I just saw this…
    applescript in automator - stop a workflow
    It kills the workflow based on a test, so I tried this…
    Here is the text if you want to copy & paste. It will fail on Apple.com & stop the workflow. Success should allow it to continue.
    on run {input, parameters}
      try
      set pinged to do shell script "ping -c 3 -q  apple.com "
      if pinged is equal to 0 then
      return input
      end if
      on error
      error number -128 -- exit by user-cancel
      end try
    end run
    on run {input, parameters}
       display dialog "Rest of script will now continue..."
      return input
    end run

  • Folder Actions will not work - tried everything

    Recently Folder Actions simply stopped working on 10.6.4. They worked fine before then recently just stopped working.
    I've tried everything I can think of, including:
    1. completely removing enabling & disabling & enabling folder actions through the setup app.
    2. trashing folder actions plist files in user domain and relaunching
    3. disabling related launchd processes with lingon
    4. trashing launch agents in user domain and also trying to unload them in terminal
    5. trying to kill the folder actions dispatcher process in activity monitor (just relaunches, as it should)
    6. emptying system caches including dyld shared cache using cocktail
    7. doing most of the above and restarting
    It's driving me nuts. Any other ideas?
    here's some entries from syslog:
    8/2/10 9:31:37 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 6 seconds
    8/2/10 9:37:29 AM Folder Actions Setup[4403] * WARNING: Method selectedRowEnumerator in class NSTableView is deprecated. It will be removed in a future release and should no longer be used.
    8/2/10 9:43:37 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.enabled[309]) Exited: Killed
    8/2/10 9:46:23 AM [0x0-0x3a03a].com.apple.systemevents[360] com.apple.FolderActions.enabled: Already loaded
    8/2/10 9:52:07 AM Folder Actions Setup[1083] * WARNING: Method selectedRowEnumerator in class NSTableView is deprecated. It will be removed in a future release and should no longer be used.
    8/2/10 9:52:16 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 7 seconds
    8/2/10 9:53:02 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 1 seconds
    8/2/10 9:56:18 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 10 seconds
    8/2/10 10:00:58 AM Folder Actions Setup[2190] * WARNING: Method selectedRowEnumerator in class NSTableView is deprecated. It will be removed in a future release and should no longer be used.
    8/2/10 10:01:01 AM com.apple.FolderActions.enabled[2236] launchctl: Error unloading: com.apple.FolderActions.folders
    8/2/10 10:01:30 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 10 seconds
    8/2/10 10:01:42 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 9 seconds
    8/2/10 10:05:03 AM sudo[2622] lryter : TTY=ttys000 ; PWD=/Users/lryter ; USER=root ; COMMAND=/bin/launchctl unload -w /Users/lryter/Library/LaunchAgents/com.apple.FolderActions.enabled.plist
    8/2/10 10:10:25 AM Folder Actions Setup[676] * WARNING: Method selectedRowEnumerator in class NSTableView is deprecated. It will be removed in a future release and should no longer be used.
    8/2/10 10:10:27 AM com.apple.FolderActions.enabled[680] launchctl: Couldn't stat("/Users/lryter/Library/LaunchAgents/com.apple.FolderActions.folders.plist"): No such file or directory
    8/2/10 10:10:27 AM com.apple.FolderActions.enabled[680] nothing found to unload
    8/2/10 10:10:38 AM com.apple.launchd.peruser.501[268] (com.apple.FolderActions.folders) Throttling respawn: Will start in 8 seconds
    8/2/10 10:13:17 AM sudo[943] lryter : TTY=ttys000 ; PWD=/Users/lryter ; USER=root ; COMMAND=/bin/launchctl unload -w /Users/lryter/Library/LaunchAgents/com.apple.FolderActions.enabled.plist
    8/2/10 10:14:01 AM com.apple.launchd.peruser.501[268] (com.apple.FolderActions.folders) Throttling respawn: Will start in 4 seconds
    8/2/10 10:14:14 AM com.apple.launchd.peruser.501[268] (com.apple.FolderActions.folders) Throttling respawn: Will start in 1 seconds

    I finally go Folders Action to work, after being unable to use it even for a simple beep for years now.
    Here is what I did:
    1. Changed permissions to 755 for the following folder and two contained files (note that 775 didn't work for me)
    ~/Library/LaunchAgents/
    ~/Library/LaunchAgents/com.apple.FolderActions.enabled.plist
    ~/Library/LaunchAgents/com.apple.FolderActions.folders.plist
    2. Changed the following lines within ~/Library/LaunchAgents/com.apple.FolderActions.enabled.plist (using TextWrangler)
    from:
    <key>OnDemand</key>
    <false/>
    to:
    <key>OnDemand</key>
    <true/>
    Prior to the permissions changes within #1 above, the value of <true/> kept getting changed back to <false/> by something in the system... and though
    there was improvement by the permissions changes, the following console message appeared until false was changed to true.
    com.apple.FolderActions.enabled[4127] launchctl: Error unloading: com.apple.FolderActions.folders
    At this point true is staying true, and not being changed by unknown forces to false, and the above message is not appearing.
    3. The only other thing I did prior to #1 and #2 above, was to run the script (unsaved),
    tell application "/System/Library/CoreServices/Folder Actions Dispatcher.app" to tick
    This little tell line caused something to occur where my Folder Action surprised me and worked for the first time though it took about 30 seconds and was erratic,
    sometimes performing, sometimes not, though if I would do move something into the folder to trigger the action that should occur, and did not occur, then at the point
    running the above tell line or script would cause the action to occur.
    4. At this point I don't fool with the tell line or script from #3, and it seems that systemevents has gotten involved, as well as launchd, and with my simple Folder Action script
    I'm getting the folder action within 10 seconds compared to 30 to 45 if ever seconds.
    5. This is still too early to tell if this is the wonder pill I've needed since Leopard, and now Snow Leopard (and maybe Tiger as well: I forget when I even tried Folder Actions).
    There was a time when I moved things around, so that the items normally found in the former AppleScript folder, were placed elsewhere in subfolders, so I don't know if that lead to this...
    because I could get Folder Actions to work on Macs in the Applestore, but not my own Mac. Watching the console messages was helpful. I don't think it's a big concern that
    deprecated messages are found sometimes. That's a just a normal part of the constantly rebuilding of things that goes on. It's more like a reminder that we've got an upgraded
    OEM part were going to start using, and the older part won't be available after such and such date, so program accordingly, and in the meantime drive.

  • Failed to attach workflow to "Downloads" as a folder action

    Hi, everyone
         I am trying to move the files and folders I get via AirDrop to a folder named AirDrop with automator. I use the following workflow
         Folder Action receives files and folders added to Downloads
         Get Specific Finder Items (Downloads)
         Get Folder Contents (Un-tick Repeat for Subfolder found)
         Filter Finder Item ( All of following are true : Name is not AirDrop )
         Move Finder Item ( To AirDrop : tick Replace existing files)
         It works perfectly fine when I tries to run it step by step or using Run button. But it doesn't work when I add a file or folder to the Downloads folder. So, I tried to remove the .workflow file from the Folder Actions and re-install it again. When I do that, this
    occurred.
         Please help me. Thanks in advance

    a rough draft of the script that answered my own question:
    tell application "Microsoft Word"
      activate
    end tell
    tell application "System Events"
      delay 0.5
      keystroke "a" using command down
      tell application process "Microsoft Word"
      click menu item "Page Setup..." of menu "File" of menu bar item "File" of menu bar 1
      delay 1
      click pop up button 3 of window "Page Setup"
      keystroke "Any"
      delay 0.5
      keystroke return
      delay 0.5
      keystroke return
      delay 1
      click menu item "Print..." of menu "File" of menu bar item "File" of menu bar 1
      delay 1
      tell menu button "PDF" of window "Print"
      click
      click menu item "Create Booklet" of menu 1
      end tell
      end tell
    end tell

  • How to set up Automator Folder Actions?

    I have set up and sucessfully tested a workflow which sends any file found in a particular folder to the "paperless" app, then moves all files to a different folder called "Archived attachments".
    HOWEVER as a folder action,  nothing happens when a file is put into the folder. The file just sits there in the folder.
    To create a folder action I opened  "new folder action" in Automator, then dragged and dropped the working workflow file into the workspace, then set "Folder Action recieves files and folders added to" the appropriate folder, let's call it "Attachments".
    Just to complicate things, the files are placed into the "Attachments" folder using an applescript that captures all pdf mail attachments. This applescript works succesfully.
    So, where could I be going wrong?
    The working workflow "Attachments.workflow" consists of:
    Get Specificed Finder Items
    Make Sequential
    Get Folder Contents
    Open Finder Items
    Get Folder Contwents
    Label Finder Items
    Get Folder Contents
    New Dated Folder
    The erronious Folder Action consists of:
    Run Workflow (Attachments)
    In folder actions setup:
    "Enable Folder Actions" is ticked
    "PDF Attachments" folder is ticked
    "Attachments_folder.workflow" script is on.

    I'm confused. You showed two Automator actions with the same name, one was a folder action one wasn't.
    Are you sure the correct Automator action (the one that is a folder action) is attached to the folder?
    If when the Folders Action setup window is opened and you select Articles_Folder.workflow and then edit script are you getting the right workflow?
    Assuming you do I would start off very simply. Try this:
    It will label green screen shot image files saved to the Desktop.
    See if this works for you.

  • Folder action delay until done

    I run a video encoding software called Episode Engine, and what it does is while encoding a video, it kicks out a temporary file in the output folder with a file size of 0. It does not actually update the filesize until encoding is complete.
    What I want to do is set a folder action to an output folder (which receives up to 5 videos at a time from encoding) that uploads the file automatically to a Transmit (FTP Client) favorite. I also want to account for the fact that I may drop large files in this folder as well, which could take time, but dont stay at 0 file size until the transfer is done. The part I'm having trouble with is delaying the transmit action until the file is done encoding. What I currently have does not work. And I dont know any way to monitor a folder action workflow, so I'm not sure where it's failing. Any recommendations?
    p.s. We're still running 10.6.8 on this computer (I know, I know...)
    property DELAY_TIME_SECONDS : 5 -- How long to wait between checking file size.
    on adding folder items to thisFolder after receiving theItems
         repeat with f in theItems
                             set currSize to 0
                             set oldSize to 0
                             set newSize to -1
                             repeat while currSize is 0
                                            delay 2
                                            set currSize to size of (info for f)
                             end repeat
                             repeat while newSize is not equal to oldSize
                                            -- Get the file size.
                set oldSize to size of (info for f)
                delay DELAY_TIME_SECONDS
                 -- Sample the size again after delay for comparison.
                                            set newSize to size of (info for f)
                             end repeat
         end repeat
    end adding folder items to

    Folder Actions has some built in support for recognizing 'busy' files, but it's not too intelligent.  It works well with Finder moves and copies, not so well with other things.  There are three ways I can think of to solve this problem.
    Tweak your script with a test for temp files so that it skips them.  This may cause secondary headaches (e.g. you skip a temp file, but Lightroom finishes the job in the ten second throttle period so the creation of the the file(s) you want to move is missed by folder actions), but there's no way to tell unless you try.
    Drop Folder Actions and set up a QueueDirectories launch agent.  This would wait for items to be added to the folder then move and delete them - you write the script to idle until temp files are done processing.
    Forget about immediate gratification and write a LaunchAgent that will sync the folders hourly using rsync.
    Which would you prefer?

  • Folder Actions script no longer runs on new file creation

    Hope this isn't trivial.......first time posting here...hopefully in the right place.I'm not a total Mac OS X newbie...and surely no techie, either. Dabbled a wee bit with Automator and scratchin' my head on this one. Help, please!
    Any idea why folder actions not running when a new file is saved? A simple add-color-label script created in Automator was workin' fine before I did a Snow Leopard-to-Leopard downgrade clean-install & account migration from external HD (TimeMachine) backup. Folder actions are enabled and script runs only if I start it with Automator Runner. Previously, it would label the file as soon as I saved it....now it needs a manual start. Is this default behavior in Leopard? Or am I missing something or doin' something wrong? Or is this a consequence of downgrade? I was sure I had the same script workin ok in my original Leopard install - though possibly un-modified at that time.
    I have no clue why, but the new version I created recently (cpl wks ago?)worked the first time I added a new file but not thereafter...and in that instance it only labelled the file in Finder upon quitting Preview (file is a Grab saved as pdf).
    The reason for the downgrade was compatibility problems with Photoshop CS4 on SL (OS & app all updated yet crashin' at the drop of a hat) - maybe due to lack of RAM? (only 1GB). Saw quite a few posts regarding SL running CS4 problems, so now I'm back to running 10.5.8 ..again.. and PS actually runs smooth like it did before.
    Maybe these console messages are a help......or am I barkin' up the wrong tree?
    6/11/11 7:44:54 PM /System/Library/CoreServices/Folder Actions Dispatcher.app/Contents/MacOS/Folder Actions Dispatcher[91] CPSGetProcessInfo(): This call is deprecated and should not be called anymore.
    6/11/11 7:44:54 PM /System/Library/CoreServices/Folder Actions Dispatcher.app/Contents/MacOS/Folder Actions Dispatcher[91] CPSPBGetProcessInfo(): This call is deprecated and should not be called anymore.
    6/11/11 7:44:54 PM /System/Library/CoreServices/AppleScript Runner.app/Contents/MacOS/AppleScript Runner[264] CPSGetFrontProcess(): This call is deprecated and should not be called anymore. 
    6/11/11 8:19:12 PM Automator Runner[415] Error while processing arguments
    6/11/11 8:20:31 PM /Applications/AppleScript/Folder Actions Setup.app/Contents/MacOS/Folder Actions Setup[420] CPSGetProcessInfo(): This call is deprecated and should not be called anymore.
    6/11/11 8:20:31 PM /Applications/AppleScript/Folder Actions Setup.app/Contents/MacOS/Folder Actions Setup[420] CPSPBGetProcessInfo(): This call is deprecated and should not be called anymore.
    6/11/11 8:20:32 PM [0x0-0x5b05b].com.apple.systemevents[421] com.apple.FolderActions.enabled: Already loaded
    And for that matter....why does Automator throw these messages? All apps (except iWork '08 apps) and OS are up to date.
        - Just a few of the many actions not loaded:
    6/11/11 7:48:25 PM Automator[294] The action “Start iTunes Visuals” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 7:48:25 PM Automator[294] The action “Stop iTunes Visuals” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 7:48:25 PM Automator[294] The action “Update iPod” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 7:56:33 PM Automator[294] name = name was not found
    6/11/11 7:56:33 PM Automator[294] name = name extension was not found
    6/11/11 7:56:33 PM Automator[294] name = file type was not found
    6/11/11 8:00:29 PM Automator Runner[339] Error while processing arguments
    6/11/11 8:00:30 PM Automator Runner[339] The action “Import Files into iTunes” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 8:00:30 PM Automator Runner[339] The action “Add Songs to iPod” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 8:00:30 PM Automator Runner[339] The action “Add Songs to Playlist” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 8:00:30 PM Automator Runner[339] The action “Apply SQL” could not be loaded because the application “Xcode” was not found.
    Do I need to wipe the drive again and re-install everything?
    Any help is greatly appreciated. Apologies if this seems long-winded.

    Folder Actions are set up a bit differently in Leopard (they use an AppleScript wrapper), and several actions have been updated to use new technologies available in Snow Leopard.  Looking at some of your console logs, it looks like some actions or workflows were just copied over from Snow Leopard.  When changing versions like that, you should rebuild the workflows so that they link to the correct actions, and check added actions for any dependencies (an action won't be loaded if it requires resources that are not available).
    Resaving your Folder Action workflow as a Folder Action Plug-in should do the trick.

  • Folder Action + Move Finder Items = Zero KB files

    I've got a folder action set that is supposed to run the Automator Action "Move Finder Items" on any file that gets placed in a specific folder (called "Folder A") and move it to "Folder B". I'm having an issue with larger files though.
    As soon as I begin to transfer the file to "folder A" , the folder action runs and results in a "Zero KB" file in "Folder B".
    Is there any way to keep the Folder Action from triggering until the file has completely copied to the folder with the Folder Action attached ("Folder A")?
    A side note: I have this same folder action running on an iMac with Mac OS 10.6.3 and it works great . (This one was made with the newer version of Automator that shipped with 10.6 vs. Automator on 10.5 which made the action I am having trouble with)
    Any input would be appreciated!

    There is a check in *Snow Leopard* to see if the items have completed their copy/download, but Leopard does not do any checking - the script is triggered immediately. You can add your own delay with a *Run AppleScript* action, though, for example:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters} -- wait for file copy to complete by testing the size of the containing folder
    set theFolders to {} -- to handle items in different folders
    set skippedItems to {}
    repeat with anItem in the input -- get a list of unique folders
    tell application "Finder"
    get (container of anItem) as alias
    if the result is not in theFolders then set the end of theFolders to the result
    end tell
    end repeat
    repeat with aFolder in theFolders
    set timeToWait to 30 -- time to wait for copy to complete
    set interval to 2 -- test every interval seconds
    set copied to false
    tell application "Finder" to set currentSize to size of aFolder -- get initial size
    repeat with timer from timeToWait to 1 by -interval -- check every interval seconds up to maximum time
    delay interval
    tell application "Finder" to set newSize to size of aFolder -- recheck size
    if (newSize is equal to currentSize) then
    set copied to true
    exit repeat -- success
    else -- update size
    set currentSize to newSize
    end if
    end repeat
    if not copied then set the end of skippedItems to quoted form of (aFolder as text) -- timed out
    end repeat
    showSkippedAlert for skippedItems
    return input
    end run
    to showSkippedAlert for skippedItems
    show an alert dialog for any items skipped, with the option to cancel the rest of the workflow
    parameters - skippedItems [list]: the items skipped
    returns nothing
    if skippedItems is not {} then
    set {alertText, theCount} to {"Error with waiting for items to copy", count skippedItems}
    if theCount is greater than 1 then
    set theMessage to (theCount as text) & space & " folders timed out"
    else
    set theMessage to "1 folder timed out"
    end if
    set theMessage to theMessage & " - copy of contents may be incomplete:"
    set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {skippedItems, AppleScript's text item delimiters} to {skippedItems as text, tempTID}
    if button returned of (display alert alertText message (theMessage & return & skippedItems) alternate button "Cancel" default button "OK") is "Cancel" then error number -128
    end if
    return
    end showSkippedAlert
    </pre>
    The action will check the folder sizes, and when there is no change (or the wait times out) the input items are passed on.

  • Help on moving specific files using folder actions

    so i want to move all downloaded files that have the extension .pdf to a folder in my docs but it doesnt always work and if i download 2 at once it fails. im new to applescripts so please help!
    this is what i have:
    on adding folder items to this_folder after receiving added_items
    tell application "Finder"
    repeat with all_items in this_folder
    if the name extension of any_item is "pdf" then
    move item to folder "Macintosh HD:Users:Campbell:Documents:Printing"
    end if
    end repeat
    end tell
    end adding folder items to

    As written, you are referring to different variables in your repeat loop for the added items (all_items, any_item, etc). The loop variable you define in the repeat statement is the one to use.
    Snow Leopard added a time delay to check if items are still being downloaded, but in Leopard you will need to do it yourself. The following script adds a wait handler that will wait for files to be downloaded (I also threw in a run handler for testing):
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    property destination : "Macintosh HD:Users:Campbell:Documents:Printing"
    property someTime : 60 -- time (in seconds) to allow files to copy/download
    on run -- application double-clicked or run from the Script Editor
    set theFolder to (choose folder)
    tell application "Finder" to set theItems to files of theFolder as alias list
    adding folder items to theFolder after receiving theItems -- process entire folder contents
    end run
    on adding folder items to this_folder after receiving added_items -- folder action
    if (waitForFilesToCopy into this_folder for someTime) then
    doStuff for added_items
    else
    display alert "Folder Action error" message "File copy/download into folder " & quoted form of POSIX path of this_folder & " did not complete in the time allowed."
    end if
    end adding folder items to
    to doStuff for someFiles
    do stuff with each file in someFiles
    parameters - someFiles [list]: a list of files to do stuff with
    returns nothing
    repeat with anItem in someFiles
    tell application "Finder"
    if the name extension of anItem is "pdf" then
    move anItem to folder destination
    -- move anItem to (path to desktop) -- testing
    end if
    end tell
    end repeat
    end doStuff
    to waitForFilesToCopy into someFolder for timeToWait
    checks every interval seconds up to timeToWait for files to be copied/downloaded to theFolder
    the test is based on the size of the folder not changing after interval seconds
    parameters - someFolder [mixed]: the folder to check
    timeToWait [integer]: a maximum timeout value in seconds
    returns [boolean]: true if copy/download finished, false if timeout
    set interval to 2 -- adjust as desired
    set someFolder to quoted form of POSIX path of someFolder
    set currentSize to first word of (do shell script "du -s " & someFolder) -- get initial size
    repeat with timer from timeToWait to 1 by -interval
    delay interval
    set newSize to first word of (do shell script "du -s " & someFolder) -- recheck size
    if (newSize is equal to currentSize) then
    return true -- success
    else -- update size
    set currentSize to newSize
    end if
    end repeat
    return false -- timed out
    end waitForFilesToCopy
    </pre>

  • Folder action: File size as a conditional and then move

    Im a complete beginner to AppleScript so please be patient with my amateur questions
    So here's what I want to do:
    I want to setup a folder action so that whenever I download a file to my Downloads folder that is larger than 50mb, it will automatically be moved to another folder. I tried to use Automator to make this but i found out it doesnt do IF-THEN stuff.
    I've searched the internet but i cant find any help!
    thanks!!!

    actually, this is a breeze in automator.  just set up a workflow like so:

  • Folder action adding date to added file

    I need to write a folde action that will add the date to a files name after it is added. can anyone help here. here is what I have done but the file still does not get named correctly.
    set m to month of (current date)
    set d to day of (current date)
    set y to year of (current date)
    if month of (current date) is January then
    set m to 1
    else
    if month of (current date) is February then
    set m to 2
    else
    if month of (current date) is March then
    set m to 3
    else
    if month of (current date) is April then
    set m to 4
    else
    if month of (current date) is May then
    set m to 5
    else
    if month of (current date) is June then
    set m to 6
    else
    if month of (current date) is July then
    set m to 7
    else
    if month of (current date) is August then
    set m to 8
    else
    if month of (current date) is September then
    set m to 9
    else
    if month of (current date) is October then
    set m to 10
    else
    if month of (current date) is November then
    set m to 11
    else
    if month of (current date) is December then
    set m to 12
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    set theshortdate to m & "/" & d & "/" & y as string
    --display dialog theshortdate
    set source_folder to "Macintosh HD 2:Users:Edit2:Desktop:test"
    tell application "Finder"
    --set theFile to every item in folder source_folder
    set old_name to "123"
    set new_name to old_name & ".scpt" & " " & theshortdate as string
    set name of file "Macintosh HD 2:Users:Edit2:Desktop:test:123.scpt" to new_name as string
    end tell

    this thing keeps repeat forever and adding the 11-1-07 date to the file name over and over, I cant figure out why
    on adding folder items to this_folder after receiving added_items
    set m to month of (current date)
    set d to day of (current date)
    set y to year of (current date)
    if month of (current date) is January then
    set m to 1
    else
    if month of (current date) is February then
    set m to 2
    else
    if month of (current date) is March then
    set m to 3
    else
    if month of (current date) is April then
    set m to 4
    else
    if month of (current date) is May then
    set m to 5
    else
    if month of (current date) is June then
    set m to 6
    else
    if month of (current date) is July then
    set m to 7
    else
    if month of (current date) is August then
    set m to 8
    else
    if month of (current date) is September then
    set m to 9
    else
    if month of (current date) is October then
    set m to 10
    else
    if month of (current date) is November then
    set m to 11
    else
    if month of (current date) is December then
    set m to 12
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    end if
    set theshortdate to m & "-" & d & "-" & y as string
    tell application "Finder"
    display dialog theshortdate
    set n to count items in added_items
    display dialog n as text
    repeat with an_item in added_items
    set file_name to name of an_item as string -- get the current name
    --display dialog file_name as string
    set newname to file_name & " " & theshortdate
    --display dialog newname
    set name of an_item to newname as text
    end repeat
    end tell
    end adding folder items to

Maybe you are looking for

  • Keyboard & trackpad not active when booted!

    Got a white 2.0GHz Intel Core2Duo 13" with 1GB RAM and OS 10.5.8. The keyboard and trackpad are suddenly locked when the the machine is booted. The cursor is in the same place after restart - not movable - but not frozen either. Because when I insert

  • How do I get my outlook files back on my computer

    I made the mistake of saying okay to iCloud for my Outlook contacts, calendar, and emails. Now I dont have anything ON my computer! It's only in iCloud! I WANT IT BACK ON MY COMPUTER!!!!!!!!!!!!!! HELP!!!!!!!!!!!!!!!!!!!

  • Icons are not Loding in ESS

    i am facing some problem when accessing the Employee Self Service using ITS.In Travel management screen, icons are not loading. Any sugestion to rectify the problem...? Thanks in Advance, Bala

  • Storing a file in a BLOB field in the database through forms

    Hi, I want to have a form that lets the user choose a file he has on his client side and load this file into a BLOB field in the database. I know how to use "GET_FILE_NAME" to get the file, the second part is what I'm having problems with. Do I use a

  • File encoding of database package

    Hi, I copied a dabase package and package body from an online database to an offline database. The package contains a procedure with a name, which contains a german umlaut. This umlaut character is not displayed correctly in the editor, because the f