@peavine
As I already wrote, I am stubborn.
I want to get the log history returned by “three sizes.scpt”.
In fact, as I enhanced it, now it’s “three sizes 1.scpt”
-- three sizes 1.scpt
-- Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) dimanche 24 mai 2020 22:33:47
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 origSize 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 wantedSize to 800
set newPath to my stamp(currentFile, wantedSize)
set origDimensions to dimensions of openedFile
set origResolution to resolution of openedFile
scale openedFile to size wantedSize
save openedFile in newPath with icon
close openedFile
set openedFile to open file newPath
set newDimensions to dimensions of openedFile
set newResolution to resolution of openedFile
close openedFile
end tell
set newSize800 to size of (info for file newPath)
tell me to display dialog "origSize : " & origSize & " 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
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 wantedSize to 1600
set newPath to my stamp(currentFile, wantedSize)
scale openedFile to size wantedSize
save openedFile in newPath with icon
close openedFile
set openedFile to open file newPath
set newDimensions to dimensions of openedFile
set newResolution to resolution of openedFile
close openedFile
end tell
set newSize1600 to size of (info for file newPath)
tell me to display dialog "origSize : " & origSize & " 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
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 wantedSize to 3200
set newPath to my stamp(currentFile, wantedSize)
scale openedFile to size wantedSize
save openedFile in newPath with icon
close openedFile
set openedFile to open file newPath
set newDimensions to dimensions of openedFile
set newResolution to resolution of openedFile
close openedFile
end tell
set newSize3200 to size of (info for file newPath)
tell me to display dialog "origSize : " & origSize & " 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 stamp(anAlias, theSize)
set theExt to name extension of (info for anAlias)
tell (current date) to set theStamp to (((its year) * 10000 + (its month) * 100 + (its day)) as text) & "_" & text 2 thru -1 of ((1000000 + (its hours) * 10000 + (its minutes) * 100 + (its seconds)) as text)
set newPath to text 1 thru -(2 + (count theExt)) of (anAlias as string) & "_" & theStamp & "_" & theSize & "." & theExt
return newPath
end stamp
#=====
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
#=====
What is really puzzling me is the fact that changeAgent sent me a video in which I see the droplet whose every instructions are disabled which execute the instruction triggering choose file.
I sent it to Shane Stanley hoping that he may explain that.
I hope that changeAgent did not made a mix of different videos to fool me but honestly I’m wondering.
Since the beginning I’m puzzled by what is described so, when I saw that the original file has a large block of null bytes at its end, I thought that it was the explanation. But some times after, when I saw that the size was correctly changed on the original file, I assumed that the supposed oddity was specific to Catalina, an OS with so many anomalies that a new one would not be surprising (in French we say “On ne prête qu’aux riches”).
Time was not completely wasted.
Now, everybody here know how to remove easily the extraneous null bytes from the end of jpeg files
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) dimanche 24 mai 2020 22:48:24