• 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: Get property size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get property size


  • Subject: Re: Get property size
  • From: "koenig.yvan" <email@hidden>
  • Date: Sat, 18 Jan 2014 18:30:25 +0100


Le 18/01/2014 à 18:12, Robert Poland <email@hidden> a écrit :

Hi,

I’m trying, using Applescript, to get the size of an image.

This is as far as I get;

set ThePicture to choose file
tell application "Finder" to set x to properties of ThePicture

How do I extract the size?

TIA,

Robert Poland

As far as I know, the set of properties returned by the Finder didn't changed for years.

set thePicture to ((path to desktop as text) & "The Great Wave.jpg") as alias

tell application "Finder" to set x to properties of thePicture
(*
{class:document file, 
name:"The Great Wave.jpg", 
index:73, 
displayed name:"The Great Wave.jpg", 
name extension:"jpg", 
extension hidden:false, 
container:folder "Desktop" of folder "yvankoenig" of folder "Users" of startup disk of application "Finder", 
disk:startup disk of application "Finder", 
position:{-1, -1}, 
desktop position:{1353, 438}, 
bounds:{-33, -33, 31, 31}, 
kind:"Image JPEG", 
label index:0, 
locked:false, 
description:missing value, 
comment:"", 
size:1359930, 
physical size:1363968, 
creation date:date "jeudi 10 décembre 2009 04:12:19", 
modification date:date "jeudi 10 décembre 2009 04:12:19", 
icon:missing value, 
URL:"file:///Users/yvankoenig/Desktop/The Great Wave.jpg", 
owner:"yvankoenig", 
group:"(inconnu)", 
owner privileges:read write, 
group privileges:read write, 
everyones privileges:read only, 
file type:missing value, 
creator type:missing value, 
stationery:false, 
product version:"", 
version:""}
*)
set theSize to size of x
--> 1359930

From my point of view it's more efficient to extract it with System Events

set thePicture to ((path to desktop as text) & "The Great Wave.jpg") as alias

tell application "System Events" to set the_size to size of disk item (thePicture as text)
—> 1359930

But, are you really wanting the size of the file or the dimensions of the picture ?


Yvan KOENIG (VALLAURIS, France) samedi 18 janvier 2014 18:30:21



 _______________________________________________
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/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Get property size
      • From: Robert Poland <email@hidden>
References: 
 >Get property size (From: Robert Poland <email@hidden>)

  • Prev by Date: Get property size
  • Next by Date: Re: Get property size
  • Previous by thread: Get property size
  • Next by thread: Re: Get property size
  • Index(es):
    • Date
    • Thread