Jump to content

error handling, scripting commands


Recommended Posts

Very new to AutoIt

I see two different 'types' (pasted below) of scripting examples:

? What is the difference bewteen the types? Example1 seems to be more 'object oreinted'? Can they both be used to navigate thru a website? Any advantages to one or the other?

? In the sample scripts I have looked through, I dont think I have seen any error handling (try... catch...). Is there an easy way to identify when a script is failing; ie. the website isnt as expected?

? Is there a way to loop through multiple open windows and close the windows that are not expected to be open?

---- example 1 ------------

#include <IE.au3>

$oIE = _IE_Example ("https://ssl.accesstocare.on.ca/")

$oSubmit = _IEGetObjByName ($oIE, "submitExample")

_IEAction ($oSubmit, "click")

_IELoadWait ($oIE)

------example 2 ------------

run("C:\Program Files\Internet Explorer\IEXPLORE.EXE https://ssl.accesstocare.on.ca/")

Winwaitactive("Better Access To Care - Windows Internet Explorer")

Send("username{TAB}")

Send("password{TAB}{TAB}")

Send("{ENTER}")

WinWaitActive(">> Better Access To Care - Windows Internet Explorer")

send("{tab 15}") ;to be in the url location

Send("{ENTER}")

WinWaitActive("Home Page - Windows Internet Explorer")

send("{tab 17}") ;to be in the url location

Send("{ENTER}")

WinWaitActive("Report Selection - Windows Internet Explorer")

send("{tab 22}") ;to be in the url location

Send("{ENTER}")

WinWaitActive("Waitlist Entries Extract - Windows Internet Explorer")

Thanks for the help

h

Link to comment
Share on other sites

Very new to AutoIt

I see two different 'types' (pasted below) of scripting examples:

? What is the difference bewteen the types? Example1 seems to be more 'object oreinted'? Can they both be used to navigate thru a website? Any advantages to one or the other?

? In the sample scripts I have looked through, I dont think I have seen any error handling (try... catch...). Is there an easy way to identify when a script is failing; ie. the website isnt as expected?

? Is there a way to loop through multiple open windows and close the windows that are not expected to be open?

---- example 1 ------------

#include <IE.au3>

$oIE = _IE_Example ("https://ssl.accesstocare.on.ca/")

$oSubmit = _IEGetObjByName ($oIE, "submitExample")

_IEAction ($oSubmit, "click")

_IELoadWait ($oIE)

------example 2 ------------

run("C:\Program Files\Internet Explorer\IEXPLORE.EXE https://ssl.accesstocare.on.ca/")

Winwaitactive("Better Access To Care - Windows Internet Explorer")

Send("username{TAB}")

Send("password{TAB}{TAB}")

Send("{ENTER}")

WinWaitActive(">> Better Access To Care - Windows Internet Explorer")

send("{tab 15}") ;to be in the url location

Send("{ENTER}")

WinWaitActive("Home Page - Windows Internet Explorer")

send("{tab 17}") ;to be in the url location

Send("{ENTER}")

WinWaitActive("Report Selection - Windows Internet Explorer")

send("{tab 22}") ;to be in the url location

Send("{ENTER}")

WinWaitActive("Waitlist Entries Extract - Windows Internet Explorer")

Thanks for the help

h

Use the _IE* functions of the IE.au3 UDF (See help file examples) for browser stuff and the regular Win* functions for any Windows dialog boxes that come up.

>_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...