I'm having a problem with a script I've written. I'm trying to automate access to this website.
Basically, I've got a large text file with about 900 different items in it. The script reads the file and splits it into separate items. Then, it sends items one at a time to the website, and stores the output in a variable. Once done, it writes the variable out to a file.
When I run the script, things seem to work fine until some point, where it crashes with the error:
This has happened in various places, from the 2nd to the 60th item in the data set. Nothing I've done, including keeping the IE window in the foreground, seems to make any difference. Is there some bug in my code I'm not seeing?
#include <IE.au3>
$filename_open = FileOpenDialog("Open File", "P:\Florida_genome\", "All Files (*.*)", 1 )
If @error Then
MsgBox(4096,"","No File(s) chosen")
Exit(2)
Else
$filename_open = StringReplace($filename_open, "|", @CRLF)
$file = FileOpen($filename_open, 0)
$MultiFASTA = ""
ProgressOn("Progress Meter", "", "0 percent")
$prog=0
While 1
$prog=$prog+0.01
ProgressSet( $prog, $prog & " percent")
$MultiFASTA = $MultiFASTA & FileReadLine($file)
If @error = -1 Then ExitLoop
$MultiFASTA = $MultiFASTA & chr(13)
Wend
FileClose($file)
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
$FASTA=StringSplit($MultiFASTA, ">")
EndIf
; Navigate to the CDD website
$oIE=_IECreate("http://www.ncbi.nlm.nih.gov/Structure/cdd/wrpsb.cgi")
$output = ""
For $a = 2 to UBound($FASTA)
; Set the form and sequence field variables (leaving the rest of the
; options at their defaults)
$o_form = _IEFormGetObjByIndex($oIE, 0)
$o_seq = _IEFormElementGetObjByName($o_form, "SEQUENCE")
$o_expect = _IEFormElementGetObjByName($o_form, "EXPECT")
$o_graph = _IEFormElementGetObjByName($o_form, "GRAPH")
; Set the value of the sequence field
_IEFormElementOptionselect ($o_expect, "0.000001", "1", "byValue", 0)
_IEFormElementOptionselect ($o_graph, "0", "1", "byValue", 0)
_IEFormElementSetValue($o_seq, chr(62) & $FASTA[$a])
_IEFormSubmit($o_form)
$gene = StringSplit($FASTA[$a], " ")
$output = $output & "---- Gene: " & $gene[1] & "----"
$output = $output & chr(13)
$output = $output & _IEBodyReadText($oIE)
$output = $output & chr(13)
$output = $output & chr(13)
_IENavigate($oIE, "http://www.ncbi.nlm.nih.gov/Structure/cdd/wrpsb.cgi")
Next
$filename_save = FileOpenDialog("Open File", "P:\Florida_genome\", "All Files (*.*)", 1 )
If @error Then
MsgBox(4096,"","No File(s) chosen")
Exit(2)
Else
$file = FileOpen($filename_open, 2)
FileWrite($file, $output)
FileClose($file)
EndIf
I've attached a sample data file for testing; it's a much smaller subset of my actual data, but caused the same error as the other file.
Thanks for any help! FS_aa_trunc.txt