Ok, I have been spending hours on this feature, I have been trying to add a “If Statement” for this script. What I wanted it to do is add the if statment at this part…
do script "
with (frames['TargetContent']) {
main.CLASS_SRCH_WRK2_CAMPUS.selectedIndex = 1;
main.CLASS_SRCH_WRK2_INSTRUCTION_MODE.selectedIndex = 8;
submitAction_main(document.main,'CLASS_SRCH_WRK2_CLASS_SRCH_PB');
}
" window (item 1 of (get ListWindows))
The probelm is that if you enter a class number to far a head, there web site says, “The search returns no results that match the criteria specifed” at the bottom, if it hits that I want the script to kill its self right there. But I have had major complications. Can anyone help me on this. Down below is the full script, run it and you will see what I mean. Thank you so so much.
try
tell application "Internet Explorer" to quit
tell application "BBEdit 6.5" to quit
end try
delay 20
tell application "Internet Explorer"
Activate
GetURL ("http://studentadmin.connectnd.us:8080/psp/NDPP84/EMPLOYEE/NDSP80/e/?url=http%3a%2f%2fstudentadmin.connectnd.us%3a80%2fservlets%2ficlientservlet%2fNDSP80%2f%3fICType%3dPanel%26Menu%3dCOMMUNITY_ACCESS%26Market%3dGBL%26PanelGroupName%3dCLASS_SEARCH" as string)
my waitLoaded()
(*Change number value for diff. semester
0510 2004 Fall
0520 2004 Winter
0530 2005 Spring
0540 2005 Summer
0610 2005 Fall *)
do script "
with (frames['TargetContent']) {
main.CLASS_SRCH_WRK2_INSTITUTION.selectedIndex = 5;
main.CLASS_SRCH_WRK2_STRM.value = '0520';
submitAction_main(document.main,'CLASS_SRCH_ADV');
}
" window (item 1 of (get ListWindows))
my waitLoaded()
do script "
with (frames['TargetContent']) {
main.CLASS_SRCH_WRK2_CAMPUS.selectedIndex = 1;
main.CLASS_SRCH_WRK2_INSTRUCTION_MODE.selectedIndex = 8;
submitAction_main(document.main,'CLASS_SRCH_WRK2_CLASS_SRCH_PB');
}
" window (item 1 of (get ListWindows))
my waitLoaded()
with timeout of (30 * minutes) seconds
do script "
with (frames['TargetContent']) {
submitAction_main(document.main, '#ICOK');
}
" window (item 1 of (get ListWindows))
end timeout
end tell
to waitLoaded()
tell application "Internet Explorer"
repeat
delay 3
if (do script "frames['TargetContent'].document.readyState" window (item 1 of (get ListWindows))) = "complete" then exit repeat
end repeat
end tell
end waitLoaded
tell application "System Events"
tell application process "Internet Explorer"
delay 30
tell window 1
keystroke "a" using command down
keystroke "c" using command down
end tell
end tell
end tell
delay 3 --> Seems to help
(* Define the file contents and write the file *)
tell me
activate
set theFileContents to the clipboard
end tell
tell application "BBEdit 6.5"
activate
tell application "System Events"
tell application process "BBEdit 6.5"
delay 20
tell window 1
keystroke "v" using command down
end tell
end tell
end tell
save document 1 to (((path to desktop) as string) & "Hybrid")
try
open for access theTargetFile with write permission
set eof of theTargetFile to 0
write (theFileContents) to theTargetFile starting at eof
close access theTargetFile
on error
try
close access theTargetFile
end try
end try
end tell
try
tell application "Internet Explorer" to quit
tell application "BBEdit 6.5" to quit
end try