Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

shankar2

macrumors 65816
Original poster
Jun 7, 2009
1,020
54
Hi so I have this Applescript code that basically works this way: You drop an image file on the Applescript icon and it fills Mac's clipboard with the image's dimension and file name (html format). Now the problem here is that this code works on Mojave macos but not on Big Sur which I use.

Here is the code, can anyone please post a fix by testing it on a Big Sur Macos computer? I've worked quite hard on this one:

====
on open theDroppedItems
set theCurrentItem to item 1 of theDroppedItems
try

tell application "Image Events"
launch
set this_image to open theCurrentItem as «class furl»
copy the dimensions of this_image to {H_res, V_res}
copy the name of this_image to originalname
close this_image
end tell

set myvar to originalname
set the clipboard to "src=\"" & myvar & "\"" & " width=\"" & H_res & "\"" & " width=\"" & V_res & "\""

end try
end open
====
 

Mark FX

macrumors regular
Nov 18, 2011
159
17
West Sussex, UK
There have been a few discussions on other AppleScript forums about issues with scripts on Big Sur.
This blog posted below highlights some of the issues.

https://latenightsw.com/big-sur/

Also I've seen various topics over at macscripter forums on the Big Sur issues.

I also remember reading about problems with third party scripting additions not working either.
But "Image Events" is an Apple standard scripting addition, so I don't think that's the issue.

But I'm not running "Big Sur", so unfortunately I can't test your code for you.
And I recently tried helping someone else here with a script which worked fine on my "Mojave".
But wouldn't work on their "Big Sur".

But check out the blog and macscripter for further help with "Big Sur" scripting issues.

Regards Mark
 

Partron22

macrumors 68030
Apr 13, 2011
2,655
808
Yes
get rid of your try, end try statements, so the script will throw errors.
Or at least use
on error xx
display dialog xx

I'm updating all my Scripts for Big Sur, and some of the issues, especially with drive manipulation, are pretty odd. Things that have worked for over a decade, no longer work, without warning. I'm doing a lot of workarounds.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.