Automater Simple yet complex task...

Discussion in 'Mac Basics and Help' started by turnontheacdc, Jun 28, 2008.

  1. turnontheacdc macrumors newbie

    Jun 28, 2008
    Alright im completely new to automater but have a small amount of C experience... anyways i want to to create a script that will refresh a certain webpage every 15 seconds and when it loads correctly (any number of ways to check this i.e. look for text other than error msg / look for image urls) (its currently down) i want it to turn on my itunes at a loud volume

    any help would be greatly appreciated

    *edit* I have 10.5

    also should i remove this post and put it in the software section??/
  2. JNB macrumors 604


    Oct 7, 2004
    In a Hell predominately of my own making
    That's a bit beyond the capability of Automator. You might look into AppleScript (included with your Mac, including a large collection of sample scripts).

    Some folks love it, others despise it, particularly as it's a "language" unto itself, and requires learning certain variables & calls that aren't found anywhere else. It's pretty straightforward, though, and if you've had some C experience, should pick it up fairly easily.
  3. tedsmith3rd macrumors member

    Aug 30, 2006
    Try zis

    I have to agree. That kind of branching seems beyond an Automator workflow. Give this applescript a try by pasting it into script editor and pressing run. It should just silently run in the background until your page loads with the specified contents.

    -- Set this to your web site's URL
    set myURL to ""
    -- Set this to a text string you expect to find in the page when it's working
    set magicWords to "I'd buy that for a dollar"
    -- set this to the number of seconds to delay between checks
    set checkInterval to 15
    -- Set this to the name of the track to play. iTunes will play the first track that contains this string
    set trackNameSearchTerm to "Shove It"
    repeat while true
        set pageContents to ""
            set pageContents to do shell script "curl " & myURL
        end try
        if pageContents contains magicWords then
            tell application "iTunes"
                set thisTrack to first track in (library playlist 1) whose name contains trackNameSearchTerm
                play thisTrack
            end tell
            display alert "Found " & magicWords & " in " & myURL buttons ("OK") giving up after 10
        end if
        delay checkInterval
    end repeat

Share This Page