• 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: In a pickle with simple resize script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: In a pickle with simple resize script


  • Subject: RE: In a pickle with simple resize script
  • From: Joe Kelly <email@hidden>
  • Date: Tue, 18 Dec 2001 15:28:12 -0800

Folder actions only work if the folder's window is open (Omitted: Rant about
how promising folder actions could be, but how utterly useless they actually
are...)

What you want to do instead is "watch" the directory for any changes:

property pFolder:""

on run
if (pFolder is "")
set pFolder to (choose folder with prompt "Where's that
*special* folder?") as string
end if
CheckFolder()
end run

on idle
CheckFolder()
return 3600 -- call idle handler again in an hour
end idle

on CheckFolder()
set deleteList to {}
tell application "Finder"
repeat with i in folder pFolder
ProcessTheFile(i)
set deleteList to deleteList & i
end

repeat with i in deleteList
delete i -- or you can simply move them to an
archive folder
end
end tell
end CheckFolder


on ProcessTheFile(inFile)
... do your image converter stuff here...
end

save this as a classic applet, with "Stay Open" checked on. You can store an
alias to the script in your Startup Items folder and forget about it.

The reason I store stuff in deleteList is in case another picture gets
dropped in the folder while the script is running -- you only delete those
items you've processed. The newly added file(s) will get processed when idle
gets called again.

A (possibly) more elegant solution would be to compare the modification date
of folder pFolder which changes when stuff is added.

I've never scripted image converter, so I can't help you there.

joe


  • Prev by Date: Re: stripping an extra character from a text item
  • Next by Date: Re: In a pickle with simple resize script
  • Previous by thread: Re: stripping an extra character from a text item
  • Next by thread: Change DHCP Client ID
  • Index(es):
    • Date
    • Thread