Applescript debugging PLEASE HELP
So I wrote this automator program that basically takes a list of sequences and inputs them into a server and appends a URL on the page into a text document
It works perfectly for a couple and then randomly just stops working and it is driving me craaaazy . i've been trying different delay times but just can't seem to figure out the problem.
so before this applescript there is a for loop then sends all the sequences to it one at a time .
1st) tabs to the text box
2nd) pastes the sequences into the text box
3rd) tabs to the Proceed button
4th) presses enter
5th) on next page, it grabs the URL that is specified at a certain position
the bug randomly happens after it pastes the sequence into the box and then it will randomly go to the URL bar at the top of Safari and get stuck doing weird things over there . this throws off the whole flow of everything ?
I REALLY want to know why this is happening ? Why would it work for like 3 or 4 andf then act up on the next one when the format for the sequences are all the same ? Do I increase a delay at a certain position ? I think one way to bypass this problem would be to tell applescript to press the proceed link" does anyone know how to do this?
delay 1
tell application "Safari" to open location "http://rna.tbi.univie.ac.at/cgi-bin/RNAfold.cgi"
delay 5
tell application "System Events"
key code 48
key code 48
delay 0.5
keystroke "v" using command down
delay 4
key code 48
key code 48
key code 48
key code 48
key code 48
key code 48
key code 48
key code 48
key code 48
keystroke return
end tell
delay 5
tell application "Safari"
set thelink to do JavaScript "document.links[4].href " in document 1
end tell
iMac