NSSize

NSEdgeInsets


AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#
005# com.cocolog-nifty.quicktimer.icefloe
006----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
007use AppleScript version "2.8"
008use framework "Foundation"
009use scripting additions
010
011property refMe : a reference to current application
012
013set ocidEdgeInsets to refMe's NSEdgeInsets's NSEdgeInsetsMake(0, 0, 0, 0)
014log ocidEdgeInsets
015
016-->(*top:0.0, left:0.0, bottom:0.0, right:0.0*)
AppleScriptで生成しました

|

Rect Point Size

Rect001
AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#  com.cocolog-nifty.quicktimer.icefloe
005----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
006use AppleScript version "2.8"
007use framework "Foundation"
008
009property refMe : a reference to current application
010
011##############################
012#RECT
013set ocidRect to refMe's NSRect's NSMakeRect(10, 20, 30, 40)
014log ocidRect as list
015-->{{10,20},{30,40}}
016log refMe's NSRect's NSMinX(ocidRect)
017log refMe's NSRect's NSMinY(ocidRect)
018
019log refMe's NSRect's NSWidth(ocidRect)
020log refMe's NSRect's NSHeight(ocidRect)
021
022log refMe's NSRect's NSMaxX(ocidRect)
023log refMe's NSRect's NSMaxY(ocidRect)
024
025log refMe's NSRect's NSMidX(ocidRect)
026log refMe's NSRect's NSMidY(ocidRect)
027
028##############################
029#
030set ocidPoint to refMe's NSPoint's NSMakePoint((refMe's NSRect's NSMinX(ocidRect)), (refMe's NSRect's NSMinY(ocidRect)))
031log ocidPoint
032log ocidPoint's x
033log ocidPoint's y
034
035set ocidSize to refMe's NSSize's NSMakeSize((refMe's NSRect's NSWidth(ocidRect)), (refMe's NSRect's NSHeight(ocidRect)))
036log ocidSize
037log ocidSize's width
038log ocidSize's height
039
040
041
AppleScriptで生成しました

|

[NSSize]よく使う記述 NSRectとの関係


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

set ocidImageRect to refMe's NSRect's NSMakeRect(120, 360, 1280, 720)
log ocidImageRect
-->(*120.0, 360.0, 1280.0, 720.0*)
log class of ocidImageRect
-->(*list*)

#######
log item 1 of ocidImageRect
(*120.0, 360.0*)

set ocidImagePoint to refMe's NSPoint's NSPointFromCGPoint(item 1 of ocidImageRect)
log ocidImagePoint
-->(*x:120.0, y:360.0*)
log class of ocidImagePoint
-->(*record*)
#
set numX to ocidImagePoint's x
set numX to x of ocidImagePoint
--> 120.0
log class of numX
--> (*real*)
set numY to ocidImagePoint's y
set numY to y of ocidImagePoint
--> 360.0
log class of numY
--> (*real*)

#######
log item 2 of ocidImageRect
(*1280.0, 720.0*)

set ocidImageSize to refMe's NSSize's NSSizeFromCGSize(item 2 of ocidImageRect)
log ocidImageSize
-->(*width:1280.0, height:720.0*)
log class of ocidImageSize
-->(*record*)
#
set numWidth to ocidImageSize's width
set numWidth to width of ocidImageSize
--> 1280
log class of numWidth
--> (*real*)
#
set numHeight to ocidImageSize's height
set numHeight to height of ocidImageSize
--> 720
log class of numHeight
--> (*real*)




|

[NSSize]よく使う記述


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

set ocidImageSize to refMe's NSSize's NSMakeSize(1280, 720)
log ocidImageSize
-->(*width:1280.0, height:720.0*)
log class of ocidImageSize
-->(*record*)

#
set numWidth to ocidImageSize's width
set numWidth to width of ocidImageSize
--> 1280
log class of numWidth
--> (*real*)
#
set numHeight to ocidImageSize's height
set numHeight to height of ocidImageSize
--> 720
log class of numHeight
--> (*real*)


set recordImageSize to ocidImageSize as record
-->(*width:1280.0, height:720.0*)

set numWidth to (recordImageSize's width) as integer
--> 1280
set numHeight to (recordImageSize's height) as integer
--> 720

set numWidth to (recordImageSize's width) as number
--> 1280.0
set numHeight to (recordImageSize's height) as number
--> 720.0



|

[NSSize] NSSizeでの画像のサイズ(ピクセルサイズ)はレコードrecord


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
(*
com.cocolog-nifty.quicktimer.icefloe
*)
#
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application


set strFilePath to "/System/Library/Desktop Pictures/Big Sur Graphic.heic" as text
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false

set ocidGifImage to refMe's NSImage's alloc()'s initWithContentsOfURL:(ocidFilePathURL)
set ocidGifImageArray to ocidGifImage's representations()
set ocidGifImageRep to ocidGifImageArray's objectAtIndex:0

set recordSize to ocidGifImageRep's |size|()
log recordSize
-->(*width:6016.0, height:6016.0*)
log class of recordSize as text
-->(*record*)

set numWidth to recordSize's width
set numWidth to width of recordSize
-->6016.0

set numHeight to recordSize's height
set numHeight to height of recordSize
-->6016.0

set ocidSize to refMe's NSMakeSize(numWidth, numHeight)
-->(*width:6016.0, height:6016.0*)
log class of ocidSize as text
-->(*record*)





|

[NSSize] NSMakeSize

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

set ocidImageSize to refMe's NSSize's NSMakeSize(1280, 720)

log ocidImageSize
-->(*width:1280.0, height:720.0*)
log class of ocidImageSize
-->(*record*)

|

その他のカテゴリー

Accessibility Acrobat Acrobat 2020 Acrobat AddOn Acrobat Annotation Acrobat ARMDC Acrobat AV2 Acrobat BookMark Acrobat Classic Acrobat DC Acrobat Dialog Acrobat Distiller Acrobat Form Acrobat JS Acrobat Manifest Acrobat Menu Acrobat Open Acrobat Plugin Acrobat Preferences Acrobat Preflight Acrobat python Acrobat Reader Acrobat SCA Acrobat SCA Updater Acrobat Sequ Acrobat Sign Acrobat Stamps Acrobat Watermark Acrobat Windows Acrobat Windows Reader Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Mobileconfig Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin Support Admin System Information Admin Tools Admin Users Admin Volumes Adobe Adobe FDKO Adobe RemoteUpdateManager AppKit Apple AppleScript AppleScript do shell script AppleScript List AppleScript ObjC AppleScript Osax AppleScript PDF AppleScript Pictures AppleScript record AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript System Events AppleScript System Events Plist AppleScript Video Applications AppStore Archive Attributes Automator BackUp Barcode Barcode QR Barcode QR Decode Bash Basic Basic Path Bluetooth BOX Browser Calendar CD/DVD Choose Chrome CIImage CityCode CloudStorage Color com.apple.LaunchServices.OpenWith Console Contacts CotEditor CURL current application Date&Time delimiters Desktop Device Diff Disk Dock DropBox Droplet eMail Encode % Encode Decode Encode UTF8 Error EXIFData ffmpeg File Finder Firefox Folder FolderAction Fonts GIF github Guide HTML HTML Entity Icon Illustrator Image Events Image2PDF ImageOptim iPhone iWork Javascript Jedit Json Label Leading Zero List locationd LRC lsappinfo LSSharedFileList m3u8 Mail MakePDF Map Math Media Media AVAsset Media AVconvert Media AVFoundation Media AVURLAsset Media Movie Media Music Memo Messages Microsoft Microsoft Edge Microsoft Excel Mouse Music NetWork Notes NSArray NSArray Sort NSBezierPath NSBitmapImageRep NSBundle NSCFBoolean NSCharacterSet NSColor NSColorList NSData NSDecimalNumber NSDictionary NSError NSEvent NSFileAttributes NSFileManager NSFileManager enumeratorAtURL NSFont NSFontManager NSGraphicsContext NSImage NSIndex NSKeyedArchiver NSKeyedUnarchiver NSLocale NSMutableArray NSMutableDictionary NSMutableString NSNotFound NSNumber NSOpenPanel NSPasteboard NSpoint NSPredicate NSPrintOperation NSRange NSRect NSRegularExpression NSRunningApplication NSScreen NSSize NSString NSString stringByApplyingTransform NSStringCompareOptions NSTask NSTimeZone NSURL NSURL File NSURLBookmark NSURLComponents NSURLResourceKey NSURLSession NSUserDefaults NSUUID NSView NSWorkspace Numbers OAuth OneDrive PDF PDFAnnotation PDFAnnotationWidget PDFContext PDFDisplayBox PDFDocumentPermissions PDFImageRep PDFKit PDFnUP PDFOutline perl Photoshop PlistBuddy pluginkit postalcode PostScript prefPane Preview Python QuickLook QuickTime ReadMe Regular Expression Reminders ReName Repeat RTF Safari SaveFile ScreenCapture ScreenSaver SF Symbols character id SF Symbols Entity sips Skype Slack Sound Spotlight sqlite SRT StandardAdditions Swift System Settings TCC TemporaryItems Terminal Text Text CSV Text MD Text TSV TextEdit Tools Translate Trash Twitter Typography UI Unit Conversion UTType valueForKeyPath Video VisionKit Visual Studio Code VMware Fusion Wacom webarchive webp Wifi Windows XML XML EPUB XML OPML XML Plist XML RSS XML savedSearch XML SVG XML TTML XML webloc XML XMP YouTube zoom