AppleScript
Bridge

FinderからショートカットでBridgeを開く

More than 1 year has passed since last update.

2016/07/17 さらに簡単に

tell application "Finder"
    try
        set myPATH to URL of (insertion location as alias)
    on error
        set myPATH to URL of item 1 of (selection as alias list)
    end try
end tell
tell application "Adobe Bridge CC" to do javascript ("new Document(" & quoted form of myPATH & ");")

一つだけある例外「検索ウインドウで何も選択していない」場合にも動作させるために…

tell application "Finder"
    try
        set myPATH to URL of item 1 of (selection as alias list)
    on error
        try
            set myPATH to URL of (insertion location as alias)
        on error
            set myPATH to URL of (desktop as alias)
        end try
    end try
end tell
tell application "Adobe Bridge CC" to do javascript ("new Document(" & quoted form of myPATH & ");")

ちっとださい。


URLエンコードで問題なく開けることが分かったので少し簡単に。

BridgeOpen3.scpt
tell application "Finder"
    try
        set myList to selection as alias list
        if length of myList < 1 then
            set beginning of myList to target of window 1 as alias
        end if
        set myItem to URL of item 1 of myList
    on error
        return
    end try
end tell

tell application "Adobe Bridge CC"
    launch
    activate
    do javascript ("new Document(\"" & myItem & "\");")
end tell

師匠に教えて貰ってもう少し簡単に
今度は何も開いてない・選択していない場合Desktopを開く

BridgeOpen3_1.scpt
tell application "Finder"
    try
        --選択をmyListにセット。使うのはリストのitem1のみなので、item1に希望のものが入っているようにする
        set myList to selection as alias list
        --何も選択していない場合は開いているウインドウかDesktopをリスト最上部にセット
        if length of myList < 1 then
            set beginning of myList to insertion location as alias
        end if
        --Bridgeに渡すためにURLエンコード
        set myItem to URL of item 1 of myList
    on error
        --検索ウインドウ等では何もしない
        return
    end try
end tell

tell application id "com.adobe.bridge6"
    launch
    activate
    do javascript ("new Document(\"" & myItem & "\");")
end tell

Finderツールバーに置いて使うタイプ。コンパイルしてアプリケーションとして保存したってください。

BridgeOpen.app
tell application "Finder"
    try
        set myItem to URL of target of window 1
    end try
end tell
tell application id "com.adobe.bridge6"
    launch
    activate
    do javascript ("new Document(\"" & myItem & "\");")
end tell

Finderツールバーに置いて使うタイプ(選択しているものを判断)

BridgeOpen.app
tell application "Finder"
    try
        set myList to selection as alias list
        if length of myList < 1 then
            set beginning of myList to target of window 1 as alias
        end if
        set myItem to URL of item 1 of myList
    on error
        return
    end try
end tell

tell application id "com.adobe.bridge6"
    launch
    activate
    do javascript ("new Document(\"" & myItem & "\");")
end tell