« タイトル内にあるアーティスト名を取り出して設定する | トップページ | [単ページ]イメージファイルをPDFに変換(72ppi換算サイズで作成) »

ファイルサイズ

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

#!/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

|

« タイトル内にあるアーティスト名を取り出して設定する | トップページ | [単ページ]イメージファイルをPDFに変換(72ppi換算サイズで作成) »

NSFontManager」カテゴリの記事