Thank you,
it’s worse than what I guessed,
the instruction
set openedFile to open (currentfile as alias)
set the variable openedFile to missing value and it’s what is reported and is perfectly described in the right pane of Script Debugger.
peavine which may run Catalina gave you the syntax required by this system but he missed what I tried to explain.
What he posted may be re-phrased as:
tell application "Image Events"
launch
end tell
on open draggeditems
repeat with currentFile in draggeditems -- here currentFile IS an alias
tell application "Image Events"
set openedFile to open file (currentFile as text)
-- set fileLocation to the location of openedFile -- DISABLED
set fileName to the name of openedFile
scale openedFile to size 800
save openedFile
close openedFile
end tell
tell application "Finder"
set the name of currentFile to (fileName) -- EDITED
end tell
end repeat
end open
And with this new spelling, it appears clearly that what you ask to the Finder is perfectly useless.
The script may be reduced to:
tell application "Image Events"
launch
end tell
on open draggeditems
repeat with currentFile in draggeditems -- here currentFile IS an alias
tell application "Image Events"
set openedFile to open file (currentFile as text)
set fileName to the name of openedFile
scale openedFile to size 800
save openedFile
close openedFile
end tell
end repeat
end open
Running 10.13.6, I applied this script to a file whose size was 1746 x 3104 pixels and the treated file is now a 450 x 800 pixels one. Of course I don’t know what is achieved under 10.15.4.
To be honest, I think tha the instructions
tell application "Image Events"
launch
end tell
may be removed too.
My understanding is tha peavine misunderstood your question.
With its code, you resize the file so that its greater dimension becomes 800 pixels.
So if you pass a file whose size was 1280 x 720 you will get a 800 x 450 pixels one which as I read your question is not what you wanted.
I understood that you wanted it to be a 1422 x 800 one.
In fact peavine understood what you posted, not what you had in mind.
On my side, I mixed the contents of two threads, this one and https://macscripter.net/viewtopic.php?id=47670 so by chance I thought to what you had in mind.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 21 mai 2020 17:21:47