« [copyItemAtPath]ファイルのコピー | トップページ | [fileExistsAtPath]ファイルの有無(フォルダの有無と同じ) »

[fileExistsAtPath]フォルダの有無

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
set objFileManager to objMe's NSFileManager's defaultManager()


######################
###調べるフォルダのパス
###Adobe Acrobat Readerのパス.appはフォルダ?
set strDirPath to "/Applications/Adobe Acrobat Reader DC.app" as text
set objDirPath to objNSString's stringWithString:strDirPath


###ファイル・フォルダの有無
set boolFolderExists to (objFileManager's fileExistsAtPath:objDirPath isDirectory:true)

log boolFolderExists
-->true or false

if boolFolderExists is true then

log "リーダーはインストール済み"
else
log "リーダーは未インストール"
end if

|

« [copyItemAtPath]ファイルのコピー | トップページ | [fileExistsAtPath]ファイルの有無(フォルダの有無と同じ) »

NSFileManager」カテゴリの記事