greendragon Posted April 10, 2014 Posted April 10, 2014 (edited) #include <SendMessage.au3> #include <MsgBoxConstants.au3> ShellExecute("C:\Users\drake\Desktop\toggle.lnk") Local $hw = WinWait("toggle", "", 2) Local $result = ControlSend($hw, "", "TEdit2", "sewsfd") MsgBox($MB_OK, "", $result) WinClose($hw) why do i get return value "0" of the controlsend function? i used the controlsend function on notepad at that time i succeed but on some application when i used the controlsend function it returned value "0" how i can get retrun value "1"? help me ~ Edited April 10, 2014 by greendragon
JohnOne Posted April 10, 2014 Posted April 10, 2014 1. You get return value of 1 because the function failed. 2. Don't know you code is a bit vague. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted April 10, 2014 Posted April 10, 2014 try that Local $hw = WinWait("toggle", "") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
somdcomputerguy Posted April 10, 2014 Posted April 10, 2014 (edited) From the Help file / ControlSendSuccess: 1.Failure: 0 if window/control is not found.pay attention to the cause of return code 0. Edited April 10, 2014 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
jdelaney Posted April 10, 2014 Posted April 10, 2014 (edited) There are too many potential fail points for us to speculate, especially because there is no error checking, except for when you output the $result...do it like this, so you know what's wrong...it's more code, but explicit...there are still some check steps you should do, like waiting for the window to be a state of enabled, verifing the control is enabled, etc: $bContinue = ShellExecute("C:\Users\drake\Desktop\toggle.lnk") If $bContinue Then ConsoleWrite("Shell execute returned true") Else ConsoleWrite("Shell execute returned false") EndIf If $bContinue Then Local $hw = WinWait("toggle", "", 2) If IsHWnd($hw) Then ConsoleWrite("Able to find toggle window handle") Else ConsoleWrite("Unable to find toggle window handle") $bContinue = False EndIf EndIf If $bContinue Then Local $hc = ControlGetHandle("toggle", "", "TEdit2") If IsHWnd($hc) Then ConsoleWrite("Able to find TEdit2 control handle") Else ConsoleWrite("Unable to find TEdit2 control handle") $bContinue = False EndIf EndIf If $bContinue Then If ControlSend($hw, "", $hc, "sewsfd") Then ConsoleWrite("Able to send sewsfd") Else ConsoleWrite("Unable to send sewsfd") $bContinue = False EndIf EndIf edit: wrong number of nested endif's Edited April 10, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now