Re: Window Swap Code Broken in High Sierra?
Re: Window Swap Code Broken in High Sierra?
- Subject: Re: Window Swap Code Broken in High Sierra?
- From: Shane Stanley <email@hidden>
- Date: Fri, 11 Aug 2017 12:18:12 +1000
On 11 Aug 2017, at 12:04 am, Jim Mitchell <email@hidden> wrote:
>
> I'm finding that the code included below, lifted pretty much verbatim from
> the AppleScript ObjC Explored 5 resource by Shane no longer works under macOS
> High Sierra. I've not had a ton of time to dig into, but when calling the
> method from another (the main app method), I get the following error:
>
> *** -[YasuAppDelegate doTheMagic:]: Can’t get origin of {{0.0, 0.0}, {500.0,
> 282.0}}. (error -1728)
It looks like there's a problem bridging NSRects. An NSRect is a struct, for
which there is no AppleScript equivalent, so it usually gets bridged to a
record, like {origin:{x:0.0, y:0.0}, |size|:{width:100.0, height:100.0}}.
Instead, 10.13 seems to be returning an array of arrays, as in {{0.0, 0.0},
{100.0, 100.0}}.
The first thing to do is for everyone affected to log bugs, in the hope that it
gets fixed before 10.13 ships.
The workaround needs to cover both eventualities, so at this stage something
like:
set theFrame to theView's frame()
if class of theFrame is record then
set {origin:{x:frameX, y:frameY}, |size|:{width:frameWidth,
height:frameHeight}} to theFrame
else
set {{frameX, frameY}, {frameWidth, frameHeight}} to theFrame
end if
Looking at the .bridgesupport file where this sort of stuff is defined shows
there has been a change, so with any luck it's a simple fix. And if that is the
cause, only NSRect is affected.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden