ファイルサイズ
#!/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 appFileManager to refMe's NSFileManager's defaultManager()
set strFilePath to "/Library/Documentation/Acknowledgements.rtf"
#####NSString
set ocidFilePathStr to refMe's NSString's stringWithString:strFilePath
#####NSPathStore2
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath
###### attributesを取得
set ocidAttributes to appFileManager's attributesOfItemAtPath:ocidFilePath |error|:(missing value)
#####ファイルサイズを取得
set ocidNSFileSize to ocidAttributes's NSFileSize
set numFileSize to ocidNSFileSize as integer
log numFileSize
#####KB
set numKB to (refMe's NSNumber's numberWithFloat:(numFileSize / 1024))
log numKB as text
log (numFileSize / 1024)
log ((round ((numFileSize / 1024) * 10)) / 10) as text
#####MB
set numKB to (refMe's NSNumber's numberWithFloat:((numFileSize / 1024) / 1024))
log numKB as text
log ((numFileSize / 1024) / 1024)
log ((round ((numFileSize / 1024) * 100)) / 100) as text
| 固定リンク
「NSFontManager」カテゴリの記事
- [NSFontManager]フォント名の取得(修正)(2024.12.24)
- [NSFont]フォント名の取得(フォント名=FULLNAME 英語 日本語ローカライズ名 postscript名)(2024.12.11)
- Fontのpostscript名を取得する(訂正)(2024.09.24)
- [NSFontManager]フォントのリストを取得する(基本編)(2024.06.18)
- [font book]フォントライブラリを作成する(2023.06.19)