[NSDictionary] Plistファイルの読み込み(initWithContentsOfURL)
あくまでも参考にしてください
行番号 | ソース |
---|---|
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 |
007 | ##自分環境がos12なので2.8にしているだけです |
008 | use AppleScript version "2.8" |
009 | use framework "Foundation" |
010 | use scripting additions |
011 | property refMe : a reference to current application |
012 | |
013 | |
014 | #パス |
015 | set appFileManager to refMe's NSFileManager's defaultManager() |
016 | set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSSystemDomainMask)) |
017 | set ocidLibraryDirPathURL to ocidURLsArray's firstObject() |
018 | set ocidFilePathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Frameworks/CoreSpotlight.framework/Versions/A/Resources/schema.loctable") isDirectory:(false) |
019 | #読み込み |
020 | set listResponse to refMe's NSDictionary's alloc()'s initWithContentsOfURL:(ocidFilePathURL) |error| :(reference) |
021 | if (item 2 of listResponse) = (missing value) then |
022 | log "initWithContentsOfURL 正常処理" |
023 | set ocidPlistDict to (item 1 of listResponse) |
024 | else if (item 2 of listResponse) ≠ (missing value) then |
025 | log (item 2 of listResponse)'s code() as text |
026 | log (item 2 of listResponse)'s localizedDescription() as text |
027 | return "initWithContentsOfURL エラーしました" |
028 | end if |
029 | # |
030 | |
031 | |
032 | |
033 | |
AppleScriptで生成しました |
| 固定リンク