2013-08-06 2 views
1

하나 이상의 다른 버전의 Firefox가 설치된 Mac에 특정 버전의 Firefox가 설치되었는지 확인하고 싶습니다. 그런 식으로 Firefox 설치를 놓칠 수 있기 때문에 단순히 version of application "Firefox"을 사용할 수 없습니다. 내 애플 스크립트 코드는 지금까지입니다 : 내가 컴파일 할 때 OS X 10.8.4 : '속성 목록 파일'에 대한 구문 오류가있는 AppleScript

tell application "Finder" 
    set firefox_list to paragraphs of (do shell script "find /Applications -name Firefox.app") 
    repeat with ff_installed in firefox_list 
     -- get version 
     set ff_ins_info to property list file (POSIX path of ff_installed & "/Contents/Info.plist") 
     set ff_ins_version to (value of property list item "Bundle version" of ff_ins_info) 
     display dialog ff_ins_version 
    end repeat 
end tell 

불행하게도 나는 오류 메시지 : Syntax Error: Expected expression but found “property”. 나는 밖으로 만들 수있는 최선의 AppleScript로는 개체로 property list file를 인식하지 않는 것이다. 내가 이해하기에 이것은 10.5 이후에 작동해야한다.

필자는 Apple의 PlistBuddy 유틸리티를 사용하여 버전 번호를 찾는 쉘 스크립트를 작성하는 것으로 생각했지만이 방법보다 훨씬 복잡합니다. 이 시점에서 grep을 통해 Plist XML을 통해 직접 떠났습니까?

미리 제안 해 주셔서 감사합니다.

  1. 이것은 최종 버전

    입니다 CFBundleVersion

Bundle version을 대체 POSIX path of을 왼쪽 tell application "System Events"tell application "Finder"을 대체 :

답변

1

나는이 작업을 진행하는 3 변경 한
tell application "System Events" 
    set firefox_list to paragraphs of (do shell script "find /Applications -name Firefox.app") 
    repeat with ff_installed in firefox_list 
     -- get version 
     set ff_ins_info to property list file (ff_installed & "/Contents/Info.plist") 
     set ff_ins_version to (value of property list item "CFBundleVersion" of ff_ins_info) 
     display dialog ff_ins_version 
    end repeat 
end tell 
+0

고마워요! "번들 버전"으로 표시되는 XCode가 실제로 "CFBundleVersion"태그가 붙어 있다는 것을 어떻게 알았습니까 (Info.plist 파일을 다루는 데 더 많은 경험이 있었을뿐)? (흠, 좋아, OmniOutliner가 제대로 표시되는 것을 본다. 그러나 설치하는 것을 기억하지 않는다.) 어쨌든,이 작업은 계속 진행할 수있다. 다시 한 번 감사의 말을 전한다. –

관련 문제