2011-02-18 1 views
2

나는 RecentApplication> 속성 - 목록 파일의 CustomListItems 재산 목록 항목의 배열 (.plist)을 열거 시도하고를 사용하여 속성 목록 항목의 배열을 열거하지만, 구문 어려움 겪고 :는 애플 스크립트

tell application "System Events" 

    set the plist_path to "~/Library/Preferences/com.apple.recentitems.plist" 
    set the plist_file to property list file plist_path 

    set itemNodes to property list item "CustomListItems" of property list item "RecentApplications" of plist_file 

    repeat with i from 1 to number of items in itemNodes 

    set itemNode to item i of itemNodes 

    display dialog text of property list item "Name" of property list item itemNode 

    end repeat 

end tell 

"System Events got an error: Can’t make every text of property list item \"Name\" of property list item (property list item \"CustomListItems\" of property list item \"RecentApplications\" of contents of property list file \"Macintosh HD:Users:craibuc:Library:Preferences:com.apple.recentitems.plist\") into type string." number -1700 from every text of property list item "Name" of property list item (property list item "CustomListItems" of property list item "RecentApplications" of contents of property list file "Macintosh HD:Users:craibuc:Library:Preferences:com.apple.recentitems.plist") to string

을 또한, 나는에 코드를 변경하는 경우 :

repeat with i from 1 to number of items in itemNodes 

    display dialog i 

    end repeat 

내가 읽기 오류가

하나의 대화 상자가 나타납니다. 즉, 배열 자체를 검사하는 것 같지 않습니다.

PLI의 배열을 캡처하는 올바른 방법은 무엇입니까?

답변

3

올바른 구문은 다음과 같습니다

set itemNodes to property list items of property list item "CustomListItems" of property list item "RecentApplications" of plist_file 

내가 '재산 목록 항목'을 추가 할 필요가 있었다.