1

El capitan で Fluid アプリ 1.8.5 を実行しており、非常に単純な Web ページを実行しています。AppleScript を使用してページ上の div のコンテンツを取得しようとしていますが、うまく動作していないようです。fluidappの変更ログには、「do Javascript」を含むapplescriptのサポートがあることが明確に記載されています

Safari ウィンドウで同じページを開くと、これは期待どおりに機能します。

if application "Safari" is running then
    tell application "Safari"
        tell document 1
            set song to do JavaScript "document.getElementById('now-playing-title').innerHTML"
            return song
        end tell
    end tell
end if

ただし、アプリケーションを流動的なアプリ (ここでは testApp) の名前に変更すると、機能しません。アプリを正しくターゲットにしていることはわかっています。次のようにすると、fluid アプリが正しくフォーカスされるためです。

if application "testApp" is running then
    tell application "testApp"
        activate
    end tell
end if

fluidapp には safari のようなドキュメントの概念がない可能性があることを理解しているので、これも試してみましたが、役に立ちませんでした。

if application "104.9" is running then
    tell application "104.9"
        set song to do JavaScript "document.getElementById('now-playing-title').innerHTML"
        return song
    end tell
end if
4

0 に答える 0