• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Folderaction problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Folderaction problem


  • Subject: Re: Folderaction problem
  • From: "John C. Welch" <email@hidden>
  • Date: Tue, 13 Feb 2007 13:04:00 -0600
  • Thread-topic: Folderaction problem

Title: Re: Folderaction problem
On 2/13/07 09:03, "Jan Bultereys" <email@hidden> wrote:

HI, I am using ‘folderaction’ with this example script...

When I drop 1 or 2 files it’s OK, but I am having problems when I drop 10 files in the folder...
The problem starts because the files are still in process of copying... How can I prevent this?

Copying files to this location will be an ongoing process, how can I run this folder action ONLY on files that have been copied completely?

Any input is much appreciated


I do like Yvan suggested and loop it. my standard clipping for this is:

on adding folder items to theFolder after receiving theAddedItems
   tell application "Finder" to set theFolderName to name of theFolder
   repeat with x in theAddedItems
       set theFileInfo to info for x --get info for the downloading file(s)
       set theBaseSize to size of theFileInfo --get initial size
       delay 3 --wait 3 seconds
       set theFileInfo to info for x --get info again
       set theCompareSize to size of theFileInfo --get a newer size
       repeat while theCompareSize ≠ theBaseSize --if they don't equal, loop until they do
           set theBaseSize to theCompareSize --new base size
           delay 3 --wait three seconds
           set theFileInfo to info for x --get info
           set theCompareSize to size of theFileInfo --get a newer size
       end repeat --once the sizes match, the download is done
   end repeat
   
    --
I put 'real' code here
   
end adding folder items to

it’s on a three second delay, which has worked well for me so far. Now, you’ll want to test this with a LOT of items and adjust if needed.

--
"The only easy day was yesterday."
US Navy SEALs
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden

References: 
 >Folderaction problem (From: Jan Bultereys <email@hidden>)

  • Prev by Date: Re: using XML directly from the web rather than a file?
  • Next by Date: FM 8 layout references w/applescript - works in one file, fails in five other identical files!
  • Previous by thread: Re: Folderaction problem
  • Next by thread: FM 8 layout references w/applescript - works in one file, fails in five other identical files!
  • Index(es):
    • Date
    • Thread