Medic873 Posted March 31, 2010 Share Posted March 31, 2010 Okay here is my code #include <IE.au3> $ErrorCount = 0; If WinExists("Courseware - Windows Internet Explorer") Then WinActivate ("Courseware - Windows Internet Explorer") WinSetState("Courseware - Windows Internet Explorer", "", @SW_MAXIMIZE) while 1 Sleep (10000) $coord = PixelSearch(941, 697, 988, 730, 0x003399) MouseClick("left", $Coord[0], $Coord[1], 1) if @error Then $ErrorCount = $ErrorCount + 1 endif if $ErrorCount = 6 Then MouseClick("left", 973, 721, 1) endif wend Else MsgBox(16, "window Not Found", "Please start web browser") endif I cant figure out why this wouldnt be working line nine im having a subscript error same as the title lol thank you for all of the help i have already recived. Link to comment Share on other sites More sharing options...
JohnOne Posted March 31, 2010 Share Posted March 31, 2010 lolJust curious, whats so funny ?Regarding your script, maybe you couls give us some indication as to what line 9 is and a hint as to how much vital code you have ommitted. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Medic873 Posted March 31, 2010 Author Share Posted March 31, 2010 $coord = PixelSearch(941, 697, 988, 730, 0x003399) that is line nine and im not to sure why it wont work it works the first time but when repeating it dosnt process it correctly. Link to comment Share on other sites More sharing options...
JohnOne Posted March 31, 2010 Share Posted March 31, 2010 The only reason that is not an array is because it cannot find the color MouseClick("left", $Coord[0], $Coord[1], 1) if @error Then $ErrorCount = $ErrorCount + 1 endif I dont think MouseClick sets @error so it most probably pointless there If you are trying to catch the Pixelsearch error then the check has to be imediately after it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
ShawnW Posted March 31, 2010 Share Posted March 31, 2010 I don't have a way to test it since I am not sure what courseware is or what you are looking for but try moveing the MouseClick line to only happen if there is no error. If PixelSearch fails and sets @error to 1, the value returned to $coord might not be an array. Therefore when you access the subscript of $coord in the MouseClick line the program will error. Link to comment Share on other sites More sharing options...
ShawnW Posted March 31, 2010 Share Posted March 31, 2010 Also just a fyi, On single command If... statements you don't need to multi-line them and add the EnfIf. You can turn... If @error Then $ErrorCount = $ErrorCount + 1 EndIf ...into... If @error Then $ErrorCount = $ErrorCount + 1 Link to comment Share on other sites More sharing options...
bo8ster Posted March 31, 2010 Share Posted March 31, 2010 Added check after PixelSearch. You could validate the $coord after PixelSearch is called because if it is invalid and you do '$coord[0]' it will fail, which is what you are seeing. include < IE.au3 > $ErrorCount = 0; If WinExists("Courseware - Windows Internet Explorer") Then WinActivate("Courseware - Windows Internet Explorer") WinSetState("Courseware - Windows Internet Explorer", "", @SW_MAXIMIZE) While 1 SetError(0) ; if you wanted to make sure it is reset every time. Sleep(10000) $coord = PixelSearch(941, 697, 988, 730, 0x003399) If Not @error Then MouseClick("left", $coord[0], $coord[1], 1) EndIf If @error Then $ErrorCount = $ErrorCount + 1 EndIf If $ErrorCount = 6 Then MouseClick("left", 973, 721, 1) EndIf WEnd Else MsgBox(16, "window Not Found", "Please start web browser") EndIf Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now