Ventura – Applescript applets no longer hide ?

Ventura 12.3 seems to have broken part of my Applescript applet – it no longer hides reliably. Previously pressing command-h or choosing the app menu=>Hide [applet] would cause the applet to hide. This has been working for over 5 years.

Now, sometimes, the applet does not hide – instead it just loses the focus. Then, clicking on the applet does not give it the focus – but clicking on the titlebar does.

But, often, the applet hides normally. I can't find a pattern except it might make a difference if hiding the applet would shift focus to Finder.

If this is due to an announced change in Ventura can someone point me to the documentation ? Otherwise, what could be going on ?

Thanks.

Replies

I can’t reproduce this issue. Here’s what I did:

  1. On macOS 13.0.1, I used Script Editor to create a new script with the text:

    on run
        delay 60
    end run
    
  2. I chose File > Export and saved it as an applet named Test.

  3. I closed the script window.

  4. I double clicked the applet in the Finder.

  5. It launched. I chose Test > Hide.

The app hid as expected.

Please try the above on your machine to make sure that it works in your environment. If so, you need to look at your script to see what it’s doing differently.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Many thanks. Yes, that test did work – the applet hides normally.

There are quite a lot of things in my applet which are different and could be involved:

  • I use Script Debugger, not Script Editor.
  • The applet is quite large with over 6,000 lines of code in 4 script files, a separate Service and 3 executables.
  • The applet has windows which are created with the Dialog Toolkit Plus script library from Shane Stanley, modified by me. [Sorry can't provide a link - this Forum rejects the URL]
  • All the applet windows are modal (due to design of the Dialog Toolkit).

Nonetheless, the main app window has been hiding normally since late 2018. I don't understand why the behaviour would change now. My only guess is that something changed in macOS recently that disclosed a flaw in my applet. Evidence for that is that versions of my applet (e.g. January 2022), which previously behaved normally, do not hide reliably in macOS 13.0.1. There was no such problem in macOS 12.

Maybe I have some deprecated code which has become problematic. For example, in the Script Library, I am using a property "NSLeftTextAlignment" instead of "NSTextAlignmentLeft". I stayed with the old form because the new form crashed my applet no matter what I tried.

Maybe the problem is the main window being modal. But why would that not be an issue before now ?

Anyway, the applet still works which I think is quite something.

this Forum rejects the URL

See tip #14 in Quinn’s Top Ten DevForums Tips.

I don't understand why the behaviour would change now.

*shrug*

macOS is under very active development and sometimes things break. In some cases that’s because of bugs in the OS and in some cases it’s caused by problems in the app. And in some cases the app is relying on functionality that makes sense but was never documented, and then it’s hard to say who’s actually at fault (-:

There are quite a lot of things in my applet which are different and could be involved:

Indeed. My advice here is that you try to isolate the specific cause by working through this stuff one step at a time. For example, if you work through my steps but instead use Script Debugger, does that fail?

I generally approach these problems from both ends. I iteratively add code to the working case and remove code from the failing case until the former starts to fail or the latter starts to work.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

See tip #14 in Quinn’s Top Ten DevForums Tips.

Many thanks – didn't know about your post.

macOS is under very active development and sometimes things break. 

Have to admit I was surprised that my applet did hide normally when I tested my first versions years ago. I thought the modal dialogs would not hide. So, I'm not surprised if an under-the-hood change in macOS made apparent my applet's flaw.

if you work through my steps but instead use Script Debugger, does that fail?

I worked through your steps using SD. I'll try exporting my applet in Script Editor and check whether the result is the same. I'll also do up a test applet using the Dialog Toolkit. At the worst, I'll have to redevelop in SwiftUI. But, that will take me many months if not years – I find Xcode and SwiftUI very hard.

Cheers.