Tasmania Posted October 4, 2007 Share Posted October 4, 2007 This is the code it errors out on: $pos = WinGetPos("Notes") $pos[1] += 25 $pos[3] -= 25 Link to comment Share on other sites More sharing options...
Developers Jos Posted October 4, 2007 Developers Share Posted October 4, 2007 Pretty sure that the Window title isn't found... try: $pos = WinGetPos("Notes") If Not @error Then $pos[1] += 25 $pos[3] -= 25 Else MsgBox(0,"error", "Window not found") EndIf SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Tasmania Posted October 4, 2007 Author Share Posted October 4, 2007 (edited) Yep, it's saying the window isn't found... hmmm, that's interesting... Edit: Easy to fix, I'll just add in a window wait, but still... that's very interesting that it works sometimes and not others... lol... Thanks Edited October 4, 2007 by Tasmania Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 4, 2007 Share Posted October 4, 2007 Acutally, it's not surprising. Sometimes the window gets the ticks it needs to come up before your script progresses, sometimes your script gets the ticks to error out before the window comes up. I run into this all the time. A good mix of soft and/or hard waits will keep everything running smoothly. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Tasmania Posted October 4, 2007 Author Share Posted October 4, 2007 Acutally, it's not surprising. Sometimes the window gets the ticks it needs to come up before your script progresses, sometimes your script gets the ticks to error out before the window comes up. I run into this all the time. A good mix of soft and/or hard waits will keep everything running smoothly.In other-words, a scripting application may run two times faster than an application that needs to download data from a database... which is what I've noticed... is this an accurate restatement? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 4, 2007 Moderators Share Posted October 4, 2007 This is a classic case (deomonstrated by Jdeb) of proper error handling preventing nasty situations.We know that WinGetPos returns an Array if successful or an @error if failed.Why would we (knowing that there is a possibility of failure) not do proper error handling ahead of time?(Notice I'm using a handle here... I try to stay away from titles if and when possible)$aPos = WinGetPos($hWnd) If @error = 0 Then ;EtcoÝ÷ ØêÚºÚ"µÍÌÍØTÜÈHÚ[Ù]ÜÊ ÌÍÚÛ BYÐ^J ÌÍØTÜÊH[Ñ]I generally use the IsArray() one because I'm thinking array here... but I'm sure @error would be much faster if speed was an issue. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Tasmania Posted October 4, 2007 Author Share Posted October 4, 2007 This is true... I will attempt to program more error handling in the future as I program instead of after the fact. It is probable that this will prevent many headaches. Thanks for the advice 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