macOS12でImage Eventsを使うときのポイント
要点はファイルを『エイリアスのリスト』で渡す事でした
ダウンロード - image20events.scpt.zip
tell application "Image Events"
launch
set objImage to open item numImageCnt of listChooseFile
set listResolution to (resolution of objImage) as list
set listDimensions to (dimensions of objImage) as list
set strR to item 1 of listResolution as text
set strW to item 1 of listDimensions as text
set strH to item 2 of listDimensions as text
set strColorSpace to (color space of objImage) as text
set strFileType to (file type of objImage) as text
set strFileName to (name of objImage) as text
set strEmbeddedProfileof to name of (embedded profile of objImage)
close objImage
end tell
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
set aliasDefDir to path to desktop folder from user domain
set listChooseFile to (choose file with prompt "ファイルを選んでください" default location aliasDefDir of type {"public.image"} with invisibles and multiple selections allowed without showing package contents) as list
set cntImageFile to (count of listChooseFile) as number
set numImageCnt to 1
repeat cntImageFile times
tell application "Finder"
set objInfo to info for item numImageCnt of listChooseFile
set strFinderName to name of objInfo
set strFinderSize to size of objInfo
set strCreationDate to creation date of objInfo
set strkind to kind of objInfo
set strUTI to type identifier of objInfo
set textMbPer to "0.0009765625" as text
set textKbPer to "0.001" as text
log objInfo
set numKb to round (strFinderSize * textKbPer)
set numMb to (numKb * textMbPer)
set strOutPut to ""
set strOutPut to strOutPut & "@@@@@@@@@@@@@@@@@@@@@\n"
set strOutPut to strOutPut & "##############:Finder\n"
set strOutPut to strOutPut & "FinderName:\t" & strFinderName & "\n"
set strOutPut to strOutPut & "FinderSize:\t" & strFinderSize & " バイト\n"
set strOutPut to strOutPut & "FinderSize:\t" & numKb & " KB\n"
set strOutPut to strOutPut & "FinderSize:\t" & numMb & " MB\n"
set strOutPut to strOutPut & "kind:\t" & strkind & "\n"
set strOutPut to strOutPut & "type identifier:\t" & strUTI & "\n"
set strOutPut to strOutPut & "CreationDate:\t" & strCreationDate & "\n"
end tell
tell application "Image Events"
launch
set objImage to open item numImageCnt of listChooseFile
set listResolution to (resolution of objImage) as list
set listDimensions to (dimensions of objImage) as list
set strR to item 1 of listResolution as text
set strW to item 1 of listDimensions as text
set strH to item 2 of listDimensions as text
set strColorSpace to (color space of objImage) as text
set strFileType to (file type of objImage) as text
set strFileName to (name of objImage) as text
set strEmbeddedProfileof to name of (embedded profile of objImage)
close objImage
end tell
set strOutPut to strOutPut & "##############:Image Events\n"
set strOutPut to strOutPut & "resolution:\t" & strR & "\n"
set strOutPut to strOutPut & "dimensionsW:\t" & strW & "\n"
set strOutPut to strOutPut & "dimensionsH:\t" & strH & "\n"
set strOutPut to strOutPut & "ColorSpace:\t" & strColorSpace & "\n"
set strOutPut to strOutPut & "FileType:\t" & strFileType & "\n"
set strOutPut to strOutPut & "FileName:\t" & strFileName & "\n"
set strOutPut to strOutPut & "embedded profile:\t" & strEmbeddedProfileof & "\n"
log strOutPut
set numImageCnt to numImageCnt + 1
end repeat
tell current application
path to desktop from user domain
XXXXXXXXX
end tell
tell application "Script Editor"
choose file with prompt "ファイルを選んでください" default location alias "Macintosh HD:Users:XXXXXXX:Desktop:" of type {"public.image"} with invisibles and multiple selections allowed without showing package contents
end tell
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Aerial.heic"
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Aerial.heic"
end tell
tell application "Finder"
end tell
tell current application
round 29.804
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Aerial.heic"
get resolution of image "Big Sur Aerial.heic"
get dimensions of image "Big Sur Aerial.heic"
get color space of image "Big Sur Aerial.heic"
get file type of image "Big Sur Aerial.heic"
get name of image "Big Sur Aerial.heic"
get name of embedded profile of image "Big Sur Aerial.heic"
close image "Big Sur Aerial.heic"
end tell
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Coastline.heic"
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Coastline.heic"
end tell
tell application "Finder"
end tell
tell current application
round 42.49
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Coastline.heic"
get resolution of image "Big Sur Coastline.heic"
get dimensions of image "Big Sur Coastline.heic"
get color space of image "Big Sur Coastline.heic"
get file type of image "Big Sur Coastline.heic"
get name of image "Big Sur Coastline.heic"
get name of embedded profile of image "Big Sur Coastline.heic"
close image "Big Sur Coastline.heic"
end tell
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Dark.heic"
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Dark.heic"
end tell
tell application "Finder"
end tell
tell current application
round 21.911
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Dark.heic"
get resolution of image "Big Sur Dark.heic"
get dimensions of image "Big Sur Dark.heic"
get color space of image "Big Sur Dark.heic"
get file type of image "Big Sur Dark.heic"
get name of image "Big Sur Dark.heic"
get name of embedded profile of image "Big Sur Dark.heic"
close image "Big Sur Dark.heic"
end tell
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Dark.heic"
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Dark.heic"
end tell
tell application "Finder"
end tell
tell current application
round 27.119
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Dark.heic"
get resolution of image "Big Sur Graphic Dark.heic"
get dimensions of image "Big Sur Graphic Dark.heic"
get color space of image "Big Sur Graphic Dark.heic"
get file type of image "Big Sur Graphic Dark.heic"
get name of image "Big Sur Graphic Dark.heic"
get name of embedded profile of image "Big Sur Graphic Dark.heic"
close image "Big Sur Graphic Dark.heic"
end tell
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Light.heic"
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Light.heic"
end tell
tell application "Finder"
end tell
tell current application
round 30.874
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Light.heic"
get resolution of image "Big Sur Graphic Light.heic"
get dimensions of image "Big Sur Graphic Light.heic"
get color space of image "Big Sur Graphic Light.heic"
get file type of image "Big Sur Graphic Light.heic"
get name of image "Big Sur Graphic Light.heic"
get name of embedded profile of image "Big Sur Graphic Light.heic"
close image "Big Sur Graphic Light.heic"
end tell
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic.heic"
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic.heic"
end tell
tell application "Finder"
end tell
tell current application
round 32.724
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic.heic"
get resolution of image "Big Sur Graphic.heic"
get dimensions of image "Big Sur Graphic.heic"
get color space of image "Big Sur Graphic.heic"
get file type of image "Big Sur Graphic.heic"
get name of image "Big Sur Graphic.heic"
get name of embedded profile of image "Big Sur Graphic.heic"
close image "Big Sur Graphic.heic"
end tell