1

我在 El capitan 上运行流体应用程序 1.8.5,我让它运行一个非常简单的网页。我正在尝试使用 applescript 在页面上提取 div 的内容,但似乎无法使其正常工作。Fluidapp更改日志特别声明他们支持 AppleScript,包括“做 Javascript”

如果我在 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,为了我们的目的),它就不起作用。我知道它正确地定位了应用程序,因为如果我执行以下操作,它会正确地使流体应用程序成为焦点。

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

我知道也许流体应用程序没有像 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