Ok, I’m trying to make an all in one app with applescript for a local football league I’m in. I want to be able to view stats, videos, and I’m thinking of more. I have the videos down, but how do I get stats. I want applescript to go to the website and fetch specific text (the teams stats) and display them in a dialog box. But at the same time I dont want a safari page opened and running it all cause that ruins the purpose of the app.
Safari cannot give you text without opening a web page. You can only choose to open Safari in background.
Or try using Dashboard widget and Amnesty’s Widget Browser to treat the widget like an application.
Here is a simple example of what chris2 is talking about, using curl:
set web_url to quoted form of "http://www.macscripter.net/viewtopic.php?id=30773" set posix_path to "~/Desktop/web_page.txt" do shell script "curl " & web_url & " | textutil -stdin -convert txt -format html -output " & posix_path -- will overwrite any existing "web_page.txt" file on your Desktop
But you say you only want a specific area of the web page. That could (hopefully) be done using grep or sed on the html source before converting it to text. You’d need to find something in the html source that identified the starting and end points of what you want. Or it could be done using AppleScript commands if there is actual text that identifies the beginning and ending paragraphs.
I dont want to use curl. So I guess it’s OK if safari is running but can i minimize it and still have it do everything? And how do I do it without curl?