AppleScript名:NSRectからの各種情報取得 |
use AppleScript version "2.4" use scripting additions use framework "Foundation" set aRect to current application’s NSMakeRect(0, 0, 100, 80) –> {origin:{x:0.0, y:0.0}, |size|:{width:100.0, height:80.0}} set aWidth to current application’s NSWidth(aRect) –> 100.0 set aHeight to current application’s NSHeight(aRect) –> 80.0 set aMinX to current application’s NSMinX(aRect) –> 0.0 set aMaxX to current application’s NSMaxX(aRect) –> 100.0 set aMidX to current application’s NSMidX(aRect) –> 50.0 set aMinY to current application’s NSMinY(aRect) –> 0.0 set aMaxY to current application’s NSMaxY(aRect) –> 80.0 set aMidY to current application’s NSMidY(aRect) –> 40.0 |
macOS 10.13以降は(何の説明もなく)NSMakeRectの返り値が変わっているので、注意が必要です。
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
set aRect to current application’s NSMakeRect(0, 0, 100, 80)
–> {origin:{x:0.0, y:0.0}, |size|:{width:100.0, height:80.0}}
–> {{0.0, 0.0}, {100.0, 80.0}}–macOS 10.13 or later
★Click Here to Open This Script
More from my site
(Visited 38 times, 1 visits today)