Ok I give up I am trying to have a box open up when the script starts then run a loop till the input in the box is met help please.
This is what i got so far.
set Dialog_1 to display dialog "How many loops?" default answer "25"
set loop1 to the text returned of the result
repeat
set counter to loop1
activate application "Firefox"
tell application "System Events"
tell process "Firefox"
click menu item "Reload" of menu 1 of menu bar item "View" of menu bar 1
set counter to counter - 1
if counter is 0 then exit repeat
end tell
end tell
end repeat
Now could someone show me what I am not doing as of right now if jusr keeps reloading the page over and over past the inputed numbers if times I want it to run.
And yes I know I need to add a delay in there for load times but have not got that far.
Hi Michael,
you set your variable counter within the repeat loop,
so it’s never been decreased.
Try this:
set loop1 to text returned of (display dialog "How many loops?" default answer "25") as integer
activate application "Firefox"
tell application "System Events"
tell process "Firefox"
repeat loop1 times
keystroke "r" using command down
delay 5
end repeat
end tell
end tell
PS: In Safari you can determine when a page has been loaded with JavaScript,
but I have no idea about FireFox
Thank you for that help.
I have got it working here is what I have.
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
activate application "Firefox"
tell application "System Events"
tell process "Firefox"
click menu item "Reload" of menu 1 of menu bar item "View" of menu bar 1
delay 5
set counter to counter - 1
if counter is 0 then exit repeat
end tell
end tell
end repeat
Now it does just what I want. I would use Safari but the site that I play at has a assload of banner ads in it.
So I use Firefox because of it’s Ad blocking add on.
I know that Firefox’s DOM is all Javascript based so I Would have to bet that someone a whole lot better then me at Javascripting could find a way to get it to tell the script that bit of info.