JDRJ
JDRJ

Reputation: 11

Applescript Alarm Clock

I am new to coding and figured I would start with applescript. I have managed to create an app via applescript that will open a page, I've even managed to link this to calendar to have it run at a specific time and date so that it will act as an alarm clock. What is beyond my skill set is to get a particular part of the webpage that opens to activate. Here is the current code, which will open NPR's front page.

tell application "Safari" activate open location "http://www.npr.org" end tell

What I would like to further do is be able to open the hourly news stream when the app runs so I can have the NPR news stream kick off to wake me up in the AM from my Mac.

Thanks for any help. -J

Upvotes: 1

Views: 365

Answers (1)

regulus6633
regulus6633

Reputation: 19032

You can use javascript in Safari to access the web page stuff. You can google many tutorials on javascript. Here's an example...

set theURL to "http://www.npr.org/"

tell application "Safari"
    tell document 1
        if URL is not theURL then
            open location theURL
            delay 5
        end if
        do JavaScript "document.getElementById('jquery_jplayer_1').click();"
    end tell
end tell

Upvotes: 0

Related Questions