2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Adobe Bridgeで開くアプリバージョンを一括変換

Last updated at Posted at 2014-09-24

① BridgeのPreferences>File Type Associationで、必要なファイルタイプにアプリを割り当てておく。バージョンはなんでも構わない

② Macなら
~/Library/Application Support/Adobe/Bridge(バージョン)/Adobe Bridge Opener Preferences.xml

バージョンによってファイル名が異なる……面倒
Adobe Bridge Opener Preferences.xml
または
Adobe BridgeOpenerPreferences.xml

このファイルをエディタで開き、Photoshopなら
app_name="Photoshop"
のある行に追加して
app_path="アプリケーションのあるフルパス"
を記入する。
(このファイルは、Bridgeでファイルタイプ関連づけを編集すると作られる)
app_pathの無いものにはとりあえず追加しておく。

③ app_pathを使用するバージョンのフルパスにエディタで一括置換

④ Bridgeを再起動

2024/06/26 再度調整。identifierが「com.adobe.bridge」と、やっとバージョン番号つけるのをやめてくれたので……

--Bridgeバージョン取得
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
	else
		--フォルダ名判別。bundleIDとパス名は記憶に頼ってるので不正確です…………
		set BridgeA to ":Adobe Bridge Opener Preferences.xml"
		set BridgeB to ":AdobeBridgeOpenerPreferences.xml"
		if bridgeIdentify is "com.adobe.bridge14" then set bPath to "Bridge 2024" & BridgeB
		if bridgeIdentify is "com.adobe.bridge" then set bPath to "Bridge 2024" & BridgeB
		if bridgeIdentify is "com.adobe.bridge12" then set bPath to "Bridge 2022" & BridgeA
		if bridgeIdentify is "com.adobe.bridge11" then set bPath to "Bridge 2021" & BridgeA
		if bridgeIdentify is "com.adobe.bridge13" then set bPath to "Bridge 2023" & BridgeB
		if bridgeIdentify is "com.adobe.bridge9" then set bPath to "Bridge CC 2019" & BridgeA
	end if
end tell

tell application "Finder"
	activate
	
	set fileTarget to (home as text) & "Library:Application Support:Adobe:" & (bPath as text)
	try --実在判定
		fileTarget as alias
	on error
		display alert "設定ファイルがありません。Bridge環境設定「ファイルタイプの関連付け」で、PNGなどの設定を適当に変更すると、自動的に環境設定ファイルが作成されますので、もう一度このスクリプトを実行してください"
		return
	end try
	set fileTarget to do shell script "echo " & fileTarget & " | sed -e 's| |\\\\ |g'"
	--xml書き替え。app_name="Photoshop"を探して、それ以降をapp_pathで書き替える
	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
	activate
	display alert "書き替えました"
end tell

20160630・配布用に調整

tell application "Finder"
	set fileTarget to (home as text) & "Library:Application Support:Adobe:Bridge CC:Adobe Bridge Opener Preferences.xml"
	try
		fileTarget as alias
	on error
		display alert "設定ファイルがありません。Bridge環境設定「ファイルタイプの関連付け」で、PNGなどの設定を適当に変更すると、自動的に環境設定ファイルが作成されますので、もう一度このスクリプトを実行してください"
		return
	end try
end tell
set app_path to do shell script "echo '" & (choose file with prompt "Photoshop本体を選択してください")'s POSIX path & "' | sed -e 's!\\/!\\\\/!g'"
do shell script "sed  -i '' -e 's/\\(app_name=\"Photoshop\"\\).*$/\\1 app_path=\"" & app_path & "\">/g' ~/Library/Application\\ Support/Adobe/Bridge\\ CC/Adobe\\ Bridge\\ Opener\\ Preferences.xml"
set myApp to "Adobe Bridge CC"
if application myApp is running then tell application myApp to quit
repeat while application myApp is running
	delay 0.1
end repeat
tell application myApp
	activate
	display alert "Done!"
end tell

AppleScript+sedってみた。

set app_path to do shell script "echo '" & (choose file)'s POSIX path & "' | sed -e 's!\\/!\\\\/!g'"
do shell script "sed  -i '' -e 's/\\(app_name=\"Photoshop\"\\).*$/\\1 app_path=\"" & app_path & "\">/g' ~/Library/Application\\ Support/Adobe/Bridge\\ CC/Adobe\\ Bridge\\ Opener\\ Preferences.xml"

Bridgeを再起動しないと反映しないし、再起動する機能をつけてみた

try
	set app_path to do shell script "echo '" & (choose file)'s POSIX path & "' | sed -e 's!\\/!\\\\/!g'"
	do shell script "sed  -i '' -e 's/\\(app_name=\"Photoshop\"\\).*$/\\1 app_path=\"" & app_path & "\">/g' ~/Library/Application\\ Support/Adobe/Bridge\\ CC/Adobe\\ Bridge\\ Opener\\ Preferences.xml"
	
	set myApp to "Adobe Bridge CC"
	if application myApp is running then tell application myApp to quit
	
	repeat while application myApp is running
		delay 0.1
	end repeat
	tell application myApp to activate
	
	
	display alert "Done!"
end try
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?