I'm afraid I don't have Mojave (I'm bricking it about Catalina).
Below is the latest version of the macro that I use on High Sierra. I reviewed the code today and one thing I did notice is that the previous version didn't import the AppKit
framework, which it now does. This might resolve the hang, and I would advise anyone who uses this macro to update it to use the corrected AppleScript.
Identify UI Element.kmmacros (19.6 KB)
AppleScript: Latest version on GitHub
System info: AppleScript version: 2.7 System version: 10.13.6
The handler that retrieves the mouse position is below. To do a quick operational check without having to download a full macro or visit GitHub for the script, then here it is:
on mouseLocation()
on mouseLocation()
script
use framework "Foundation"
use framework "AppKit"
property this : a reference to current application
property parent : this
property NSEvent : a reference to NSEvent of this
property NSScreen : a reference to NSScreen of this
on mouseLocation()
set [list, [number, height]] to ¬
NSScreen's ¬
mainScreen()'s ¬
frame()
tell NSEvent's mouseLocation() to ¬
{its x, height - (its y)}
end mouseLocation
end script
result's mouseLocation()
end mouseLocation