• 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
Image Events Caching issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Image Events Caching issue


  • Subject: Image Events Caching issue
  • From: "Jesse Almanrode - JA Computing" <email@hidden>
  • Date: Fri, 19 Jan 2007 18:55:47 -0700

I am writing a script to gather dimension information from multiple
images. However, when I assign a variable to the dimensions of the
first image the stick forever. Say the first image is 1920x1200 and
the second image is 1024x768, the first image registers properly as
1920x1200 but the second image does not. Rather, Image Events returns
that it has the same dimensions as the first image which is not true.
I have to actually tell Image Events to quit to clear its "cache" but
then my script errors out because a variable's value is not defined.

Any ideas?

Here is the script... simple but soon to be more powerful


property SIZE_LIST : {"800", "1024", "1280", "1600", "1920"}

on open theList
	tell application "Finder"
		repeat with x in SIZE_LIST
			try
				do shell script "mkdir ~/Desktop/" & x --Create new directories
for images to get organized into
			end try
		end repeat
		repeat with x in theList
			set theImage to x as alias
			tell application "Image Events"
				open theImage
				set imageSize to dimensions of front image
				close theImage
			end tell

			set imageWidth to item 1 of imageSize as number

			if imageWidth < 1000 then
				set imagePath to quoted form of POSIX path of theImage
				do shell script "mv " & imagePath & " ~/Desktop/800"
			else if imageWidth ≥ 1000 and imageWidth ≤ 1200 then
				set imagePath to quoted form of POSIX path of theImage
				do shell script "mv " & imagePath & " ~/Desktop/1024"
			else if imageWidth ≥ 1200 and imageWidth ≤ 1400 then
				set imagePath to quoted form of POSIX path of theImage
				do shell script "mv " & imagePath & " ~/Desktop/1280"
			else if imageWidth ≥ 1400 and imageWidth ≤ 1800 then
				set imagePath to quoted form of POSIX path of theImage
				do shell script "mv " & imagePath & " ~/Desktop/1600"
			else if imageWidth ≥ 1800 then
				set imagePath to quoted form of POSIX path of theImage
				do shell script "mv " & imagePath & " ~/Desktop/1920"
			end if
		end repeat
	end tell
end open



--
Jesse Almanrode
Webmaster/Systems Administrator
www.jacomputing.net
 _______________________________________________
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

  • Follow-Ups:
    • Re: Image Events Caching issue
      • From: kai <email@hidden>
    • Re: Image Events Caching issue
      • From: Emmanuel <email@hidden>
  • Prev by Date: Mail's background color
  • Next by Date: AppleScript. launch executable without waiting for it to terminate
  • Previous by thread: Mail's background color
  • Next by thread: Re: Image Events Caching issue
  • Index(es):
    • Date
    • Thread