Greetings from perhaps the most inelegant scripter in all of PowerPro-
dom! I am one of the uncautious ones who have automated some
logins. I monitor whether a page has loaded by watching the lower
bar in IE for the text "Done" before moving on to the next sequence.
Here is a sample script:
-=-=-=-=-=-=-=-=-=-=-=--=-
local cap1 = "about:blank - Microsoft Internet Explorer"
local cap3 = "caption after successful login*"
local yg = "Login window caption"
;;//run a new instance of Explorer
;;//And call the SBC Yahoo! login page
iexplore.exe
wait.until(1000)
local h1 = win.handle(cap1,"")
;;//Wait for up to 30 sec for IExplorer to load, checking every 1/2
second
For(e=1;e<61;e=e+1)
wait.until(500)
if (h1) do
break
endif
if(e==60)do
message "Explorer loading timed out"
quit
endif
EndFor
;;//Now load the specific URL
http://mySpecial_account
;;//Wait for up to 30 sec for the first page to load, checking every
1/2 second
For(b=1;b<61;b=b+1)
wait.until(500)
If(win.childtextbyindex(yg,18)=="Done")do
break
EndIf
If (b==60) do
message "Page loading timed out"
quit
endif
Endfor
;;//Perform the login
wait.until(500)
keys accountName{tab}
wait.until(500)
keys Password{en}
;;//These can also be handled through variables that are set at
startup
;;//Wait for up to 30 sec for the login to be approved
For(c=1;c<61;c=c+1)
wait.until(500)
If(win.childtextbyindex(cap3,18)=="Done")do
break
EndIf
If (b==60) do
message "Login timed out"
quit
endif
EndFor
;;//Optional. Re-direct the page to a specific area you always want
this routine to start at
wait.until(500)
http://someOtherURL
quit
-=-=-=-=--=-=-=-==-=
Told you it was inelegant! If anyone else out there has a different
approach I'm all eyes.
to find the index of the window that shows your specific text,
first use
win.childhandlelist("your window caption*", "your special text")
give that value to some variable like
local myVar = win.childhandlelist("your window caption*", "your
special text")
when you win.debug(myVar) it will return a list (hopefully only 1
item) of the handles
of the childwindows with that text in that window caption
then run the program again, but remove the text, and you'll get a
list of all the window handles.
count forward from 1 until you identify the handle for the window you
just identified.
That number is the index of the child window that contains your text.
When I started this the index was 15, but then it changed to 16 (I
think when I added the Google button), and just yesterday it again
changed to 18 (again in response to a change in IE caused by a change
in the Google toolbar). So your situation may be different.
I have not figured out how to do this using Firefox. Maybe some of
the more elegant script-writers out there can help.
Cheers,
Dave
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/power-pro/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/