Modify

Opened 10 years ago

Closed 10 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 by BrewManNH, 10 years ago

Resolution: Rejected
Status: newclosed

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

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.