0

整理の目的で、ホットキーを使用して、選択した画像ファイルを (Finder のように) すばやくコピーし、選択したフォルダーのアイコンとして貼り付けて、[情報を見る] に移動する必要がないようにしたいと考えています。フォルダ。

これは可能ですか?

4

1 に答える 1

0

おそらく 2 つのスクリプトが必要です。1 つは画像 (ファイルではなく画像自体) をコピーするスクリプトで、もう 1 つは画像をアイコンとして貼り付けるスクリプトです。
画像をコピー:

tell application "Finder"
    open selection using (path to application "Preview") -- open with Preview
end tell

tell application "Preview"
    tell application "System Events"
        keystroke "a" using command down -- select all
        keystroke "c" using command down -- copy
        keystroke "w" using command down -- close window
    end tell
end tell

画像をアイコンとして貼り付け:

tell application "Finder"
    activate
    tell application "System Events"
        keystroke "i" using command down -- open info

        -- set focus on icon image
        tell process "Finder"
            set img to (image 1 of scroll area 1 of front window)
            set focused of img to true
        end tell

        keystroke "v" using command down -- insert image
        keystroke "w" using command down -- close window
    end tell
end tell

これら 2 つのスクリプトをいくつかのホットキーにバインドできます。そのために FastScripts を使用します。

注 1 : SystemPreferences -> Accessibility で補助デバイスへのアクセスを有効にする必要がある場合があります
注 2 : スクリプトの一部が機能しない場合 (たとえば、プレビューは開いているが、画像が選択されていないなど) は、試してみてください。遅れます。

于 2013-03-25T13:37:54.767 に答える