myspacee Posted April 20, 2009 Share Posted April 20, 2009 hello, try to send some text to an open window. Find this that send text when notepad gain focus: Local $hWnd = WinGetHandle("Untitled - Notepad") While WinExists($hWnd) If WinActive($hWnd) Then ControlSetText($hWnd, "", "[CLASSNN:" & ControlGetFocus($hWnd) & "]","What you want") Sleep(10) WEnd but windows is redrawn and mantain only send text not older (also with flag = 0) my goal : - a script that send text to a window without focus, or - that send text to last window with focus. Thank you for info, m. Link to comment Share on other sites More sharing options...
Zedna Posted April 20, 2009 Share Posted April 20, 2009 (edited) Local $hWnd = WinGetHandle("Untitled - Notepad") While WinExists($hWnd) ControlSetText($hWnd, "", "Edit1","What you want") Sleep(10) WEnd Edited April 20, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
myspacee Posted April 20, 2009 Author Share Posted April 20, 2009 thank you for reply, but not solve my problem: Make little step forward: #Include <Misc.au3> $dll = DllOpen("user32.dll") while 1 $focused_window = winGetTitle("[ACTIVE]") $hWnd = WinGetHandle($focused_window) sleep(100) If _IsPressed("0D", $dll) Then;if you press [enter] ControlSetText($hWnd, "", "Edit1","What you want",0) EndIf WEnd This script send some text on focused window when press [enter] problem are : - how find focused window classname and relative controlID ? [now send text only to notepad] ControlSetText ( "title", "text", controlID, "new text" [, flag] ) - how avoid window to be redrawn ? [', flag]' seems not working] m. Link to comment Share on other sites More sharing options...
myspacee Posted April 20, 2009 Author Share Posted April 20, 2009 better: #Include <WinAPI.au3> #Include <Misc.au3> $dll = DllOpen("user32.dll") Local $h_my_script = WinGetHandle(@ScriptName) while 1 $focused_window = winGetTitle("[ACTIVE]") $hWnd = WinGetHandle($focused_window) sleep(100) If _IsPressed("0D", $dll) Then;if you press [enter] if $h_my_script <> $hWnd Then _WinAPI_SetFocus($hWnd) Send("Today's time/date is") EndIf EndIf _WinAPI_SetFocus($h_my_script) WEnd anyone can improve/correct ? m. Link to comment Share on other sites More sharing options...
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