Jump to content

Recommended Posts

Posted

So I'm trying to find out why it's not inputting into this rate box however I never get the error msg I've put in for error handling

Func InputRate($Rate)   
Local $hWnd1 = WinWait("[CLASS:ThunderRT6FormDC]", "", 10)ControlSend($hWnd1, "", "ThunderRT6TextBox13", $Rate)
If @error = 1 Then   MsgBox(($MB_ICONINFORMATION, "", "Cannot enter $Rate number")
EndIf  
FileWrite($hFilehandle, @CRLF & $Rate)
Sleep(4000)

EndFunc

How come I don't get the msgbox?
 

  • Developers
Posted

Where does it state in the helpfile that the @eeror is set? 

Quote

Return Value

Success: a handle to the requested window.
Failure: 0 if timeout occurred.

Just test for the returned value in $hWnd1. ;)

Jos

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

If you want to test for an error then test for the value that is returned in case of an error. This value is 0 (according to Jos' post.
So try:

Func InputRate($Rate)  
    Local $hWnd1 = WinWait("[CLASS:ThunderRT6FormDC]", "", 10)
    If $hWnd1 = 0 Then   
        MsgBox(($MB_ICONINFORMATION, "", "Cannot enter $Rate number")
    Else
        ControlSend($hWnd1, "", "ThunderRT6TextBox13", $Rate)
        FileWrite($hFilehandle, @CRLF & $Rate)
    EndIf  
EndFunc

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
×
×
  • Create New...