"Can't get application id missing value" if used in compiled from

That will teach me to try everything possible before I post. Opened two different applications, started working with both, triggered the script (now an application) and it prompted me to save both documents before quitting the applications.

Absolutely fantastic!

1 Like

I tested it more and it turns out the problem is the on main().

For example, the following dialog won’t appear:

on main()
  display dialog "test"
end main

Do you know why is that? I’m on macOS 15.3.2

I don’t think that your example is a correct use of “on main ()”.

The following is correct when trying to display a dialog window.

set theDialogText to "test"
display dialog theDialogText

john202307. I primarily use a handler (which I happen to name “main”) in this circumstance to prevent top-level variables from being saved with scripts on computers running older versions of macOS. This is seldom an issue any more, and I won’t do that in the future. To fix whatever issue this handler is causing (although I can’t imagine what that would be), just delete all of the following lines:

on main()
end main

main()
1 Like

Oops sorry! I was in a big hurry and stress these days. I simply overlooked the function call (main() ) while copying. Shame on me :face_with_diagonal_mouth: