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 Changed 10 years ago by BrewManNH
- Resolution set to Rejected
- Status changed from new to closed
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.
Note: See
        TracTickets for help on using
        tickets.
    

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") ThenAs it is to write this
WinActive("Notepad") If @error Then ;~ or If @error <> 0 Then