Jump to content

Recommended Posts

  • Developers
Posted

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.
  :)

Posted (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 by Tasmania
Posted

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

Posted

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?

  • Moderators
Posted

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.

Posted

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 :)

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
  • Recently Browsing   0 members

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