I can’t guess what you made wrongly but you did.
Please click the button [Open this Scriplet in your Editor:] which appears below:
and save this script as “resize to 800.app” with absolutely no change !
-- save this one as "resize to 800.app"
-- I disabled useless instructions
on open draggeditems
tell application "Image Events" to launch
repeat with currentFile in draggeditems
tell application "Image Events"
set openedFile to open file (currentFile as string)
--Part 3:
--set fileLocation to the location of openedFile
--set fileName to the name of openedFile
--Part 4:
scale openedFile to size 800
save openedFile with icon
close openedFile
end tell
(*
--Part 5:
tell application "Finder"
set the name of file fileName of fileLocation to ¬
(fileName)
end tell
*)
end repeat
end open
Please click the button [Open this Scriplet in your Editor:] which appears below:
and save this script as “resize to 1200.app” with absolutely no change !
-- save this one as "resize to 1200.app"
-- I disabled useless instructions
on open draggeditems
tell application "Image Events" to launch
repeat with currentFile in draggeditems
tell application "Image Events"
set openedFile to open file (currentFile as string)
--Part 3:
--set fileLocation to the location of openedFile
--set fileName to the name of openedFile
--Part 4:
scale openedFile to size 1200
save openedFile with icon
close openedFile
end tell
(*
--Part 5:
tell application "Finder"
set the name of file fileName of fileLocation to ¬
(fileName)
end tell
*)
end repeat
end open
EDITED FROM HERE
Please click the button [Open this Scriplet in your Editor:] which appears below:
and save this script as “resize to 1600.app” with absolutely no change !
-- save this one as "resize to 1600.app"
-- I disabled useless instructions
on open draggeditems
tell application "Image Events" to launch
repeat with currentFile in draggeditems
tell application "Image Events"
set openedFile to open file (currentFile as string)
--Part 3:
--set fileLocation to the location of openedFile
--set fileName to the name of openedFile
--Part 4:
scale openedFile to size 1600
save openedFile with icon
close openedFile
end tell
(*
--Part 5:
tell application "Finder"
set the name of file fileName of fileLocation to ¬
(fileName)
end tell
*)
end repeat
end open
Please click the button [Open this Scriplet in your Editor:] which appears below:
and save this script as “three sizes.scpt” with absolutely no change !
UNTIL HERE
property mode : 1 -- try with the values 1, 2, 3
-- 1 --> alias
-- 2 --> «class furl»
-- 3 --> POSIX Path
--on open draggeditems
set draggedItems to choose file of type {"public.jpeg"} with multiple selections allowed
tell application "Image Events" to launch
repeat with currentFile in draggedItems
if mode = 1 then
set thePicture to currentFile as text
else if mode = 2 then
set thePicture to currentFile as «class furl» --> «class furl»
else if mode = 3 then
set thePicture to POSIX path of currentFile --> text
end if
set origSizeXXX to size of (info for currentFile)
tell application "Image Events"
if mode = 1 then
set openedFile to open file thePicture
else
set openedFile to open thePicture
end if
--set fileLocation to the location of openedFile
--set fileName to the name of openedFile
set origDimensions to dimensions of openedFile
set origResolution to resolution of openedFile
scale openedFile to size 800
save openedFile with icon
set newDimensions to dimensions of openedFile
set newResolution to resolution of openedFile
close openedFile
end tell
set newSize800 to size of (info for currentFile)
tell me to display dialog "origSizeXXX : " & origSizeXXX & " bytes" & linefeed & "origDimensions : " & my recolle(origDimensions, ", ") & linefeed & "origResolution : " & my recolle(origResolution, ", ") & linefeed & "newDimensions : " & my recolle(newDimensions, ", ") & linefeed & "newResolution : " & my recolle(newResolution, ", ") & linefeed & "newSize800 : " & newSize800 & " bytes" & linefeed
set origSize800 to size of (info for currentFile)
tell application "Image Events"
if mode = 1 then
set openedFile to open file thePicture
else
set openedFile to open thePicture
end if
--set fileLocation to the location of openedFile
--set fileName to the name of openedFile
set origDimensions to dimensions of openedFile
set origResolution to resolution of openedFile
scale openedFile to size 1600
save openedFile with icon
set newDimensions to dimensions of openedFile
set newResolution to resolution of openedFile
close openedFile
end tell
set newSize1600 to size of (info for currentFile)
tell me to display dialog "origSize800 : " & origSize800 & " bytes" & linefeed & "origDimensions : " & my recolle(origDimensions, ", ") & linefeed & "origResolution : " & my recolle(origResolution, ", ") & linefeed & "newDimensions : " & my recolle(newDimensions, ", ") & linefeed & "newResolution : " & my recolle(newResolution, ", ") & linefeed & "newSize1600 : " & newSize1600 & " bytes" & linefeed
set origSize1600 to size of (info for currentFile)
tell application "Image Events"
if mode = 1 then
set openedFile to open file thePicture
else
set openedFile to open thePicture
end if
--set fileLocation to the location of openedFile
--set fileName to the name of openedFile
set origDimensions to dimensions of openedFile
set origResolution to resolution of openedFile
scale openedFile to size 3200
save openedFile with icon
set newDimensions to dimensions of openedFile
set newResolution to resolution of openedFile
close openedFile
end tell
set newSize3200 to size of (info for currentFile)
tell me to display dialog "origSize1600 : " & origSize1600 & " bytes" & linefeed & "origDimensions : " & my recolle(origDimensions, ", ") & linefeed & "origResolution : " & my recolle(origResolution, ", ") & linefeed & "newDimensions : " & my recolle(newDimensions, ", ") & linefeed & "newResolution : " & my recolle(newResolution, ", ") & linefeed & "newSize3200 : " & newSize3200 & " bytes" & linefeed
end repeat
--end open
#=====
on recolle(l, d)
local oTIDs, t
set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
set t to l as text
set AppleScript's text item delimiters to oTIDs
return t
end recolle
#=====
It’s a slightly edited version of the one which I sent to your mailbox.
Run it from the Script Editor without any change.
You are supposed to get this log history:
Please don't click the button [Open this Scriplet in your Editor:],
this is not a script but a log history !
tell application "Script Editor"
choose file of type {"public.jpeg"} with multiple selections allowed
--> {alias "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"}
end tell
tell application "Image Events"
launch
end tell
tell current application
info for alias "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
--> {name:"2 copy 2.jpg", creation date:date "mercredi 6 mai 2020 à 17:16:56", modification date:date "mercredi 6 mai 2020 à 17:16:56", size:1754025, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"jpg", displayed name:"2 copy 2.jpg", default application:alias "SSD 1000:Applications:Preview.app:", kind:"Image JPEG", file type:", file creator:", type identifier:"public.jpeg", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Image Events"
open file "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
--> image "2 copy 2.jpg"
get dimensions of image "2 copy 2.jpg"
--> {3264, 1836}
get resolution of image "2 copy 2.jpg"
--> {72.0, 72.0}
scale image "2 copy 2.jpg" to size 800
save image "2 copy 2.jpg" with icon
--> file "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
get dimensions of image "2 copy 2.jpg"
--> {800, 450}
get resolution of image "2 copy 2.jpg"
--> {72.0, 72.0}
close image "2 copy 2.jpg"
end tell
tell current application
info for alias "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
--> {name:"2 copy 2.jpg", creation date:date "dimanche 24 mai 2020 à 13:46:38", modification date:date "dimanche 24 mai 2020 à 13:46:38", size:52949, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"jpg", displayed name:"2 copy 2.jpg", default application:alias "SSD 1000:Applications:Preview.app:", kind:"Image JPEG", file type:", file creator:", type identifier:"public.jpeg", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Script Editor"
display dialog "origSizeXXX : 1754025 bytes
origDimensions : 3264, 1836
origResolution : 72,0, 72,0
newDimensions : 800, 450
newResolution : 72,0, 72,0
newSize800 : 52949 bytes
"
--> {button returned:"OK"}
end tell
tell current application
info for alias "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
--> {name:"2 copy 2.jpg", creation date:date "dimanche 24 mai 2020 à 13:46:38", modification date:date "dimanche 24 mai 2020 à 13:46:38", size:52949, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"jpg", displayed name:"2 copy 2.jpg", default application:alias "SSD 1000:Applications:Preview.app:", kind:"Image JPEG", file type:", file creator:", type identifier:"public.jpeg", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Image Events"
open file "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
--> image "2 copy 2.jpg"
get dimensions of image "2 copy 2.jpg"
--> {800, 450}
get resolution of image "2 copy 2.jpg"
--> {72.0, 72.0}
scale image "2 copy 2.jpg" to size 1600
save image "2 copy 2.jpg" with icon
--> file "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
get dimensions of image "2 copy 2.jpg"
--> {1600, 900}
get resolution of image "2 copy 2.jpg"
--> {72.0, 72.0}
close image "2 copy 2.jpg"
end tell
tell current application
info for alias "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
--> {name:"2 copy 2.jpg", creation date:date "dimanche 24 mai 2020 à 13:46:42", modification date:date "dimanche 24 mai 2020 à 13:46:42", size:126642, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"jpg", displayed name:"2 copy 2.jpg", default application:alias "SSD 1000:Applications:Preview.app:", kind:"Image JPEG", file type:", file creator:", type identifier:"public.jpeg", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Script Editor"
display dialog "origSize800 : 52949 bytes
origDimensions : 800, 450
origResolution : 72,0, 72,0
newDimensions : 1600, 900
newResolution : 72,0, 72,0
newSize1600 : 126642 bytes
"
--> {button returned:"OK"}
end tell
tell current application
info for alias "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
--> {name:"2 copy 2.jpg", creation date:date "dimanche 24 mai 2020 à 13:46:42", modification date:date "dimanche 24 mai 2020 à 13:46:42", size:126642, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"jpg", displayed name:"2 copy 2.jpg", default application:alias "SSD 1000:Applications:Preview.app:", kind:"Image JPEG", file type:", file creator:", type identifier:"public.jpeg", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Image Events"
open file "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
--> image "2 copy 2.jpg"
get name of image "2 copy 2.jpg"
--> "2 copy 2.jpg"
get dimensions of image "2 copy 2.jpg"
--> {1600, 900}
get resolution of image "2 copy 2.jpg"
--> {72.0, 72.0}
scale image "2 copy 2.jpg" to size 3200
save image "2 copy 2.jpg" with icon
--> file "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
get dimensions of image "2 copy 2.jpg"
--> {3200, 1800}
get resolution of image "2 copy 2.jpg"
--> {72.0, 72.0}
close image "2 copy 2.jpg"
end tell
tell current application
info for alias "SSD 1000:Users:**********:Desktop:2 copy 2.jpg"
--> {name:"2 copy 2.jpg", creation date:date "dimanche 24 mai 2020 à 13:46:44", modification date:date "dimanche 24 mai 2020 à 13:46:44", size:320141, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"jpg", displayed name:"2 copy 2.jpg", default application:alias "SSD 1000:Applications:Preview.app:", kind:"Image JPEG", file type:", file creator:", type identifier:"public.jpeg", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Script Editor"
display dialog "origSize1600 : 126642 bytes
origDimensions : 1600, 900
origResolution : 72,0, 72,0
newDimensions : 3200, 1800
newResolution : 72,0, 72,0
newSize3200 : 320141 bytes
"
--> {button returned:"OK"}
end tell
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) dimanche 24 mai 2020 14:20:46