« [NSMutableArray] removeObjectsAtIndexes Rangeで指定した範囲の項目を削除 | トップページ | [NSCFBoolean] integerValue() boolValue() intValue() »

[FileManager]NSDirectoryEnumerationSkipsHiddenFiles(不可視ファイルを除く)

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

######ログ表示
doLogView()

property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSURL : a reference to objMe's NSURL
property objNSArray : a reference to objMe's NSArray
property objNSDirectoryEnumerationSkipsHiddenFiles : a reference to objMe's NSDirectoryEnumerationSkipsHiddenFiles
property objNSURLNameKey : a reference to objMe's NSURLNameKey


property objNSNotFound : a reference to 9.22337203685477E+18 + 5807

set objFileManager to objMe's NSFileManager's defaultManager()


set strDirPath to "/Users/Shared/Relocated Items"

##Make NSString
set ocidNSString to objNSString's stringWithString:strDirPath
log ocidNSString as text
log ocidNSString's className() as text

set ocidURLPath to objNSURL's fileURLWithPath:ocidNSString
log ocidURLPath as text
log ocidURLPath's className() as text

set ocidFileFile to objFileManager's contentsOfDirectoryAtURL:ocidURLPath includingPropertiesForKeys:{objNSURLNameKey} options:objNSDirectoryEnumerationSkipsHiddenFiles |error|:(missing value)


repeat with objFiles in ocidFileFile
log objFiles as text
end repeat




#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
tell application "Script Editor"
tell application "System Events"
tell process "Script Editor"
tell window 1
tell splitter group 1
tell splitter group 1
tell group 1
tell checkbox "返された値"
set boolValue to value as boolean
end tell
if boolValue is false then
click checkbox "返された値"
end if
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end if
end repeat

end doLogView
#########################

|

« [NSMutableArray] removeObjectsAtIndexes Rangeで指定した範囲の項目を削除 | トップページ | [NSCFBoolean] integerValue() boolValue() intValue() »

AppleScript NSFileManager」カテゴリの記事