Help us understand the problem. What is going on with this article?

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

More than 3 years have 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
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
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  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
ユーザーは見つかりませんでした