Re: AppleScriptObjC oddity
Re: AppleScriptObjC oddity
- Subject: Re: AppleScriptObjC oddity
- From: Takaaki Naganoya <email@hidden>
- Date: Mon, 13 Jul 2015 18:05:25 +0900
There is my sample AppleScriptObjC script.
http://piyocast.com/as/archives/3270
--
Takaaki Naganoya
email@hidden
http://piyocast.com/as/
> 2015/06/24 6:40、Steve Mills <email@hidden> のメール:
>
> I recently learned about AppleScriptObjC and how you can call Cocoa stuff from AppleScript. Thanks Shane! I noticed something weird though. I have a script that will move some apps' windows to my left screen when I get to the office and have plugged in an external monitor as my main (right) screen.
>
> If I run the script from ScriptDebugger, from the system script menu, or from LaunchBar, it works as expected. But if I run it via a global key equiv I've set on a DragThing item, it works wrong. It appears that different apps are returning different values for NSScreen's frame. Could this be because DragThing still appears to be a Carbon app?
>
> use scripting additions
> use framework "AppKit" -- for NSScreen
>
> set ss to current application's NSScreen's screens()
> set leftScreenBox to (ss's objectAtIndex:1)'s frame()
>
> Since I'm new to AppleScriptObjC, is there some way to have "current application" be the app that is being targeted by the script, so I can ensure it's working with a Cocoa app that will return the correct values? Like:
>
> tell app "Safari"
> set ss to current application's NSScreen's screens()
> end tell
>
> From my tests, "current application" always seems to be the app that executed the script.
>
> Steve
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden