2

I'm running fluid app 1.8.5 on El capitan, and I have it running a very simple web page. I'm trying to pull the contents of a div on the page using an applescript, but can't seem to get it working. the fluidapp changelog specifically states that they have applescript support, including 'do Javascript'

If I open the same page in a safari window, this works as expected:

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

However, If I change the application to the name of my fluid app (testApp, for our purposes,) it does not work. I know it is correctly targeting the app, because if I do the following, it correctly brings the fluid app to focus.

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

I understand that maybe fluidapp does not have the notion of a document like safari does, so I've also tried this to no avail:

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
snn
  • 405
  • 5
  • 15
  • Is it possible that your fluid app still requires the concept of a document? `tell document 1`? Have you looked at the dictionary for your fluid app? – ThrowBackDewd May 04 '16 at 01:18
  • @ThrowBackDewd I have tried `tell document 1` to no avail. How do I look at the dictionary? – snn May 04 '16 at 14:19
  • In script editor, there is an option for "open dictionary". Select that, then navigate to your fluid app and select it. – ThrowBackDewd May 04 '16 at 14:29
  • 1
    @shomanishikawa Did you ever figure out how to accomplish this? I am facing the same situation. – rubik's sphere Mar 04 '18 at 07:01

0 Answers0