Modify

Opened 4 years ago

Closed 4 years ago

#3133 closed Feature Request (Rejected)

Win* functions to set @error or @extended flag in case of fail / timeout

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

Now Win* functions have only one return value:

Success: a handle to the window.
Failure: 0 if the window is not found.

Success: a string containing the complete window title.
Failure: "" if the window is not found.

and so on. I think it would produce more readable, simpler code if
Win* functions also can set @error or @extended flag in case of fail or timeout

Maybe same could be applied to other functions with only one return value

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by BrewManNH

  • Resolution set to Rejected
  • Status changed from new to closed

How would that make the code more readable or simpler? It already tells you it's failed by not returning 1, I don't see any gain to be made by adding an error code that has no meaning.

It's just as readable and, frankly, simpler to write this:

If WinActive("Notepad") Then

As it is to write this

WinActive("Notepad")
If @error Then
;~ or
If @error <> 0 Then

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.