oasis375 1 Report post Posted May 5, 2015 (edited) [Sorry I meant "send keystrokes"]Title is self explaining. I don't understand why this doesn't work:#include <SendMessage.au3> #include <WindowsConstants.au3> Run("notepad.exe") $hWnd = WinWait("[CLASS:Notepad]", "", 10) $hControl = ControlGetHandle($hWnd, "", "Edit1") ;This works ControlSend($hControl, "", "", "hello") ;This doesn't work _SendMessage($hControl, "hello")[Just in case. This is a "thought experiment"; don't ask me why I don't use Send(), ControlSend(), etc.] Edited May 5, 2015 by oasis375 Share this post Link to post Share on other sites
Chimp 444 Report post Posted May 5, 2015 _SendMessage doesn't send "strings", it sends "events" to controlshave a look here small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Share this post Link to post Share on other sites
Danp2 273 Report post Posted May 5, 2015 Because you are using _SendMessage in an inappropriate way.Hint: The second parameter should be a numeric value, not a string. [UDF] WebDriver (W3C compliant) Latest version Share this post Link to post Share on other sites
oasis375 1 Report post Posted May 5, 2015 Thank you, guys. This is what works:#include <SendMessage.au3> #include <WindowsConstants.au3> Run("notepad.exe") $hWnd = WinWait("[CLASS:Notepad]", "", 10) $hControl = ControlGetHandle($hWnd, "", "Edit1") $text = "this is a line" $struct_string = DllStructCreate("char[" & StringLen($text) + 1 & "]") DllStructSetData($struct_string, 1, $text) _SendMessageA($hControl, $WM_SETTEXT, 0, DllStructGetPtr($struct_string)) Share this post Link to post Share on other sites
Chimp 444 Report post Posted May 5, 2015 how did you go from that trivial mistake in the first post to this fine example posted here so quickly? Good! great progress in so little time... small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Share this post Link to post Share on other sites