Thursday, December 5, 2019

#1 2019-11-07 01:23:42 am

ppayne
Member
From:: Isesaki, Japan
Registered: 2007-10-31
Posts: 63
Website

Catalina has broken Image Evens

Can anyone else concur? This script, and pretty much all the things I used to do with Image Events to automate image work, has died.

set this_file to choose file
try
    tell application "Image Events"
        -- start the Image Events application
        launch
        -- open the image file
        set this_image to open this_file
        -- extract the property value
        copy the resolution of this_image to {H_res, V_res}
        -- purge the open image data
        close this_image
    end tell
    display dialog "Resolution: " & (H_res as string)
on error error_message
    display dialog error_message
end try

Offline

 

#2 2019-11-07 02:35:28 am

ldicroce
Member
Registered: 2017-11-25
Posts: 137

Re: Catalina has broken Image Evens

I also get an error with Catalina 10.15.0
L.

Offline

 

#3 2019-11-07 07:47:06 am

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 234

Re: Catalina has broken Image Evens

ppayne wrote:

Can anyone else concur? This script, and pretty much all the things I used to do with Image Events to automate image work, has died.


I'm on Mojave now and confirmed that ppayne's script works as expected. I previously upgraded to Catalina and found that many of my script's--including several utilizing Image Events and sips--would not work. I didn't spend much time troubleshooting this, as I quickly realized that Catalina was not a worthwhile upgrade for me. I'm sure in time I will give Catalina another try, though, and look forward to any fixes suggested by forum members.

Last edited by peavine (2019-11-07 07:53:58 am)


2018 Mac mini - macOS Catalina

Offline

 

#4 2019-11-08 07:17:29 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6062

Re: Catalina has broken Image Evens

There seem to be two issues with Image Events and Catalina.

First, it doesn't seem to be able to deal with aliases. In the sample code above, the open command returns missing value, so the rest of the script goes nowhere. However, if you pass a file reference -- «class furl» -- the open command works.

The second issue is that, depending where the image is, you may need permission to read the file, and in such cases no prompt appears. Presumably that's because Image Events is a background-only app. You can get around this by going to System Preferences -> Security & Privacy -> Privacy and adding Image Events to Full Disk Access.

So this now works here:

Applescript:

set this_file to (choose file) as «class furl»
tell application "Image Events"
   launch
   set this_image to open this_file
   copy the resolution of this_image to {H_res, V_res}
   close this_image
end tell
display dialog "Resolution: " & (H_res as string)

Last edited by Shane Stanley (2019-11-08 07:18:15 pm)


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#5 2019-11-30 11:00:35 am

vince
Member
Registered: 2002-12-14
Posts: 64

Re: Catalina has broken Image Evens

Practical question….

When you go to Privacy and click "Full Disk Access" and then the "+", you are presented with a file dialog. Entering "Image" as search term, Image Events can't be found in the list I am presented when searching "This Computer".

If I run the script I get a dialog that Script Debugger needs to access Image Events, but that isn't "Full Disk Access".

So how does one find this invisible background app?


vince angeloni

Offline

 

#6 2019-11-30 08:06:02 pm

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 234

Re: Catalina has broken Image Evens

vince wrote:

So how does one find this invisible background app?


I found Image Events in /System/Library/CoreServices.

Initially, the script Shane posted worked with an image file on my boot drive but not with an image file on an external drive. After adding Image Events to Security & Privacy, as Shane described in his post, the script worked with the image file on the external drive.

Last edited by peavine (2019-11-30 08:12:41 pm)


2018 Mac mini - macOS Catalina

Offline

 

#7 2019-11-30 09:29:33 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6062

Re: Catalina has broken Image Evens

vince wrote:

If I run the script I get a dialog that Script Debugger needs to access Image Events, but that isn't "Full Disk Access".

So how does one find this invisible background app?



peavine has given you the answer, but you can also let Script Debugger find it for you. Click somewhere in your Image Events code and press command-D, which will open its dictionary. Control-click on Image Events in the dictionary sidebar and you will see Reveal "Image Events" in Finder.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#8 2019-12-01 07:49:37 am

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 234

Re: Catalina has broken Image Evens

Shane Stanley wrote:

There seem to be two issues with Image Events and Catalina.
First, it doesn't seem to be able to deal with aliases. In the sample code above, the open command returns missing value, so the rest of the script goes nowhere. However, if you pass a file reference -- «class furl» -- the open command works.



I retried PPayne's original script under Catalina and, as Shane predicted, it returned:

Can’t get resolution of missing value.



The script does work after coercing the choose-file command to «class furl» or to text. Image Events supports aliases, so I guess this is just a bug.

Last edited by peavine (2019-12-02 09:17:33 am)


2018 Mac mini - macOS Catalina

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)