Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
OrganizationAdvent CalendarQiitadon (β)
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?




~/Library/Application Support/Adobe/Bridge 2021/Adobe Bridge Opener Preferences.xml

tell application "System Events"
    set bridgeIdentify to null
    set alist to bundle identifier of every process
    repeat with i from 1 to count of alist
        set a to item i of alist
        if a contains "com.adobe.bridge" then
            set bridgeIdentify to a as text
        end if
    end repeat
    if bridgeIdentify is null then
        display alert "バージョンを取得したいので、Bridgeは起動しておいてください"
        error number -128
        if bridgeIdentify is "com.adobe.bridge11" then set bPath to "Bridge 2021"
        if bridgeIdentify is "com.adobe.bridge10" then set bPath to "Bridge 2020"
        if bridgeIdentify is "com.adobe.bridge9" then set bPath to "Bridge CC 2019"
    end if
end tell

tell application "Finder"
    set fileTarget to (home as text) & "Library:Application Support:Adobe:" & (bPath as text) & ":Adobe Bridge Opener Preferences.xml"

    try --実在判定
        fileTarget as alias
    on error
        display alert "設定ファイルがありません。Bridge環境設定「ファイルタイプの関連付け」で、PNGなどの設定を適当に変更すると、自動的に環境設定ファイルが作成されますので、もう一度このスクリプトを実行してください"
    end try
    set fileTarget to do shell script "echo " & fileTarget & " | sed -e 's| |\\\\ |g'"
    set app_path to (choose file with prompt "Photoshop本体を選択してください")'s POSIX path
    set nameTemp to (items 1 thru -2 of characters of app_path)
    set app_path to POSIX path of (nameTemp as string)
    do shell script "sed -i -e 's|\\(app_name=\"Photoshop\"\\).*|\\1 app_path=\"" & app_path & "\">|g' " & POSIX path of fileTarget
end tell

set Bridge to application id bridgeIdentify
if Bridge is running then tell Bridge to quit
repeat while Bridge is running
    delay 0.5
end repeat
tell Bridge
    display alert "書き替えました"
end tell
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away