Ok here is what I want to do but I need some help putting the code together.
First off I need to pop up a box asking what sectors I want. It needs to take the sector numbers in this form lowest to highest.
Like this sector 50 to sector 1000.
Then I need it to take those numbers and with the script use this URL; http://mybnt.net/rsmove.php?engage=1&destination= and then have the applescript fill in the destination= part with the next number like this destination=51 52 53 54 ect ect.
With a 10 second delay then send the next URL till it gets to the last number that I have put into the text box.
Any help would be great.
Thank you all for your time.
Model: iBook G4 1.02 GHz 512 MB or RAM
AppleScript: Version 2.2 (2.2) AppleScript 2.0
Browser: Safari 3.1 (5525.9)
Operating System: Mac OS X (10.5)
try this…
set urlBase to "http://mybnt.net/rsmove.php?engage=1&destination="
set delayURL to 10
display dialog "Enter the beginning and end sectors to get." default answer "" buttons {"Cancel", "OK"} default button 2
copy the result as list to {text_returned, button_pressed}
set {firstNum, secondNum} to stripNumbers(text_returned)
repeat with i from firstNum to secondNum
set theURL to urlBase & i
open location theURL
delay delayURL
tell application "Safari"
close window 1
end tell
end repeat
(*========= SUBROUTINES ==========*)
on stripNumbers(theText)
set text item delimiters to "sector"
set b to text items of theText
set text item delimiters to ""
set c to b as text
set text item delimiters to "to"
set b to text items of c
set text item delimiters to ""
set c to b as text
set text item delimiters to ""
return words of c
end stripNumbers
That works great just wise I understood more about how it’s doing it voodoo.
I had to mod it a bit but here what I have so far.
set urlBase to "http://mybnt.net/rsmove.php?engage=1&destination="
set urlpage to "http://mybnt.net/main.php"
set delayURL to 5
display dialog "Enter the beginning and end sectors to get." default answer "" buttons {"Cancel", "OK"} default button 2
copy the result as list to {text_returned, button_pressed}
set {firstNum, secondNum} to stripNumbers(text_returned)
repeat with i from firstNum to secondNum
set theURL to urlBase & i
open location theURL
delay 1
open location urlpage
delay delayURL
tell application "Safari"
close window 1
end tell
end repeat
(*========= SUBROUTINES ==========*)
on stripNumbers(theText)
set text item delimiters to "sector"
set b to text items of theText
set text item delimiters to ""
set c to b as text
set text item delimiters to "to"
set b to text items of c
set text item delimiters to ""
set c to b as text
set text item delimiters to ""
return words of c
end stripNumbers
Now what I would like to know if I can make Safari close the RealSpace Move tab, and not close the whole window.
RealSpace Move is what the header is for that page that the first part is calling to.
I know that I have a script that will click on a ok box that pops up on one of those pages and I had to know the page name to do that. I hope that you can see where I am trying to go with this.
If you might mark up your code so that I can lean what it’s doing and how and why so that I can lean from your help.
Thank you all for your time.
Model: iBook G4 1.02 GHz 512 MB of RAM
AppleScript: Version 2.2 (2.2) AppleScript 2.0
Browser: Safari 3.1 (5525.9)
Operating System: Mac OS X (10.5)
see if this helps…
set urlBase to "http://mybnt.net/rsmove.php?engage=1&destination="
set urlpage to "http://mybnt.net/main.php"
set delayURL to 5
-- display the dialog box
display dialog "Enter the beginning and end sectors to get." default answer "" buttons {"Cancel", "OK"} default button 2
copy the result as list to {text_returned, button_pressed} -- get the result of the dialog box
set {firstNum, secondNum} to stripNumbers(text_returned) -- strip out the numbers from the text returned from the dialog box
repeat with i from firstNum to secondNum -- loop through the numbers from the low to the high
set theURL to urlBase & i -- add the number to the end of the base url
open location theURL -- open the url in web browser
delay 1
open location urlpage -- open the url in web browser
delay delayURL
tell application "Safari"
tell window 1 -- tell the front window
set theIndices to index of tabs -- get a list of the index numbers of each tab
close tab (item -1 of theIndices) -- close the last tab which will be the last tab opened
end tell
end tell
end repeat
(*========= SUBROUTINES ==========*)
on stripNumbers(theText) -- this strips the numbers from the text
set text item delimiters to "sector"
set b to text items of theText -- remove the word sector
set text item delimiters to ""
set c to b as text -- convert the list to a string
set text item delimiters to "to"
set b to text items of c -- remove the word to from the text
set text item delimiters to ""
set c to b as text -- convert the list to a string
set text item delimiters to ""
return words of c -- return the string as a list of the 2 numbers
end stripNumbers
Thank you for that help I am starting to get my head around some this stuff now.:lol: