Ok I have moved off of firefox because OmniWeb does what I wish Safari would do.
Anyway that and it is hell of scriptalbe. Now here is what I want it to do for me, I want the script to open up a window asking how many times to loop the script for.
Then have in the script or the loop part of the script open up a web page by a set URL,
then to reload the page for the count set in the pop up box when it first runs.
set loop1 to display dialog "How many loops?" default answer "25"
set loop1 to the text returned of the result
set counter to loop1
repeat
tell application "OmniWeb" to OpenURL "http://www.eternalduel.com/fight.php?action=attack&id=22" toWindow 0
delay 5
set counter to counter - 1
if counter is 0 then exit repeat
end repeat
end
Ok I have taken what I did with firefox to do a reload of a page and dumped it and now you can see what I have but what I get is 25 new windows of that same page not what I want at all. What it should do is open up the page and then reload that page.
Could someone point me to what I am doing worng here.
Model: PowerBook G3 400 Mhz
AppleScript: 1.10.7 editor is 2.1.1 (81)
Browser: OmniWeb 5.5.4 v607.17
Operating System: Mac OS X (10.4)
try:
set loop1 to display dialog "How many loops?" default answer "25"
set loop1 to the text returned of the result
set counter to loop1
tell application "OmniWeb"
set newURL to "http://www.eternalduel.com/fight.php?action=attack&id=22"
set theBrowser to front browser
set theTab to active tab of theBrowser
repeat
set address of active tab of theBrowser to newURL
delay 5
set counter to counter - 1
if counter is 0 then exit repeat
end repeat
end tell
Thank you for that help.
Would you mind braking down what the lines are doing as I am just getting into scripting.
By the way I have seen that OmmiWeb 5.5.4 now has a call that can be used in applescripts to ask if the page is loaded.
I would like to know how to use that and lose the delay call.
Thanks for any and all help.
OK could someone tell me how to use
browser‚n [inh. window > item] : A web browser window.
elements
contains tabs; contained by application, workspaces.
properties
active tab (tab) : the tab currently being displayed in this browser.
address (Unicode text) : the URL currently being displayed in this browser.
has favorites (boolean) : whether the browser window displays the favorites shelf
has tabs (boolean) : whether the browser window displays the tabs drawer
has toolbar (boolean) : whether the browser window has a toolbar
is busy (boolean, r/o) : whether the browser is currently working on its display.
shows address (boolean) : whether the browser window always displays the address (URL) field
the bold text part so that I can do away with my delay call in the script?
Ok thanks for a whole lot of not.
All I was needing was how to put into the 2nd script so that applescript will use it.
Because I don’t know the Syntax that will make applescript happy.:mad:
Michael,
Sometimes it takes us a bit to get back to you, don’t lose your patience!
Anyway, the dictionary listing you showed for the Browser object says that is busy is a boolean. I don’t have OmniWeb (I’m one of those slugs that likes Safari, I guess), but the syntax should be:
set loop1 to display dialog "How many loops?" default answer "25"
set loop1 to the text returned of the result
set counter to loop1
tell application "OmniWeb"
set newURL to "http://www.eternalduel.com/fight.php?action=attack&id=22"
set theBrowser to front browser
set theTab to active tab of theBrowser
repeat with theCount from counter to 1 by -1
set address of active tab of theBrowser to newURL
repeat while (is busy of theBrowser)
--just keep looping until is busy is false
end
end repeat
end tell
I also re-wrote the outer repeat loop because repeat has many forms, one of which is with (a counter variable) from (start value) to (end value) by (value to increment each time).
Thank you your replay I guess I need someone to show me what your are doing in the re do of the script as I don’t get how or what you are doing after the is busy part of the script.
The first repeat loop is the one from the original script, that loads the page x number of times. The loop:
repeat while (is busy of theBrowser)
--just keep looping until is busy is false
end
keeps repeating as along as the browser reports that it is busy (because it is loading a page). As soon as it stops loading, the is busy property becomes false and execution will pickup after the end statement.
If you haven’t already, you should read some of the excellent books on Applescripting. We have a bunch of reviews here on Macscripter. If you can’t afford to buy a book, check your local library. Mine has some good ones and yours might too.
Also, the Applescript Sourcebook has lots of help for beginners (check the Applescript for Absolute Starters section). The Sourcebook was a huge help to me 10 years ago and I’m very lucky to be involved in adding to the information there.
And if you don’t have it already, the Applescript Language Guide is a bit old but is Apple’s only official manual on the subject. If you scroll down the contents list in the left side, there is a PDF of the manual you can download to keep.