0

デスクトップ上のアイテムを選択し、ショートカットを入力して、選択したアイテムをメッセージ アプリで新しいメッセージに添付できるようにしたいと考えています。システム設定/キーボード/キーボードショートカット/Finder.appの下のアプリケーションショートカットで「共有>メッセージ」と入力して作成しようとしましたが、機能しませんでした。automator で作成した「選択した新しいメール」へのショートカットがありますが、メッセージはそこにありません。また、Better Touch Tool を使用してスワイプ ジェスチャで実行できるように、Applescript またはターミナル コマンドを検索してみました。Apple の上級顧問と話をしたところ、彼はそれを行う方法もフォーラムに投稿する方法もわからないと言いました。

このアクションのショートカットを作成する方法を知っている人がいたら教えてください。

更新:これを /System/Library/PrivateFrameworks/ShareKit.Framework/Versions/A/Plugins/Message s.sharingservice/Contents/MacOS からコピーしました

この行を automator で .service にできるかどうかを誰かが知っている場合は、その方法/変更方法を教えてください。

ありがとう

/System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/PlugIns/Messages .sharingservice/Contents/MacOS/Messages ; 出口; NAME-Mac: ~ NAME$ /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/PlugIns/Message s.sharingservice/Contents/MacOS/Messages ; 出口; -bash: /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/PlugIns/Message s.sharingservice/Contents/MacOS/Messages

-- 

delay 0.218623 timeoutSeconds を 2.000000 に設定 uiScript を「アプリケーション プロセス \"Finder\" のスクロール エリア 1 のグループ 1 のイメージ \"Test File\" をクリックする」に設定 my doWithTimeout( uiScript, timeoutSeconds )

-- メッセージ遅延 0.263641 timeoutSeconds を 2.000000 に設定 uiScript を「アプリケーション プロセス \"Finder\" のスクロール エリア 1 のグループ 1 のメニュー 1 のメニュー アイテム \"Share\" のメニュー アイテム \"Message\" をクリックする」に設定します" 私の doWithTimeout( uiScript, timeoutSeconds )

doWithTimeout(uiScript, timeoutSeconds) で endDate を (現在の日付) + timeoutSeconds に設定 繰り返し試行 スクリプトを実行 "tell application \"System Events\" " & uiScript & " end tell" exit エラーで繰り返す errorMessage if ((current date) > endDate ) その後、エラー「できません」 & uiScript end if end try end repeat end doWithTimeout

4

1 に答える 1

0

それらを実行する方法がわかりません。

「Finder」でファイルとフォルダーに入力を設定してAutomatorサービスをセットアップできます

このコードを Run Applescript アクションで使用します。

それは機能しますが、問題だった主なことは、正しいバディを取得することでした. 好きな方を選べるように設定しました。名前を入力すると、一致する名前とハンドルの小さなリストが返されると思います。

on run {input, parameters}

    set buddieList to {}
    set splitter to "======"
    tell application "Messages"
        --set buddieList to {name of buddies, handle of buddies}
        repeat with i from 1 to number of items in buddies
            set this_item to item i of buddies
            copy (name of this_item as string) & splitter & handle of this_item as string to end of buddieList

        end repeat
    end tell


    set inputAlias to item 1 of input as alias

    set text_returned to item 1 of (choose from list buddieList with prompt "TO:" without multiple selections allowed and empty selection allowed)
    set theBuddy to (do shell script "echo  " & quoted form of text_returned & " | awk -F" & splitter & " '{print $2}'")
    tell application "Messages"
        set theBuddy to first buddy whose handle is theBuddy

        send inputAlias to theBuddy

    end tell

end run

**アップデート。

あなたのコメントへの回答: 私は実際にはファインダー共有の検索フィールドを使用しませんでした。そのため、私がセレクターを構築したのと同じ方法で実際に構築されているのを確認できてよかったです。:-)

しかし、友達リストではなく連絡先を検索しているようです。

したがって、この新しいスクリプトは、入力したテキストを含む連絡先名の検索を使用します。そして、本当のシェアと同じように。個人番号または電子メールが iMessages の最後にリンクされるという保証はありません。

また、これを数分でまとめることに注意してください。そのため、可能な限り整頓されていません。しかし、それはあなたに遊ぶ何かを与えます。

on run {input, parameters}

    set buddieList to {}
    set splitter to "======"
    tell application "Messages"
        activate
        display dialog "Name Contains.." default answer "" buttons {"Cancel", "OK"} default button 2
        copy the result as list to {text_returned, button_pressed}

    end tell
    tell application "Contacts"

        set buddies to people whose name contains text_returned

        repeat with a from 1 to number of items in buddies

            set this_name to name of item a of buddies
            set this_email to email of item a of buddies
            set this_phone to phone of item a of buddies
            repeat with e from 1 to number of items in this_email

                set this_email_item to item e of this_email
                if this_email_item is not {} then
                    copy (this_name) & splitter & value of this_email_item as string to end of buddieList
                end if
            end repeat

            repeat with e from 1 to number of items in this_phone

                set this_iphone_item to item e of this_phone
                if this_iphone_item is not {} then
                    copy (this_name) & splitter & value of this_iphone_item as string to end of buddieList
                end if
            end repeat

        end repeat
    end tell

    tell application "Messages" to set text_returned to item 1 of (choose from list buddieList with prompt "TO:" without multiple selections allowed and empty selection allowed)

    set inputAlias to item 1 of input as alias

    set theBuddy to (do shell script "echo  " & quoted form of text_returned & " | awk -F" & splitter & " '{print $2}'")
    tell application "Messages"
        try
            set findBuddy to first buddy whose handle is theBuddy


            send inputAlias to findBuddy
        on error
             display dialog "NO BUDDY Found with " & theBuddy
        end try
    end tell

end run

Automator の Run Applescript アクションに入れることを意図しています。サービスとして。それをコピーして貼り付け、すべてのデフォルト コードを置き換えます。

ここに画像の説明を入力

于 2012-12-13T19:36:28.727 に答える