Zamp Posted March 24, 2007 Posted March 24, 2007 Earlier I was playing around with the Hwnd thing, and found out you can use it to send stuff to notepad as long as it's the active window. This is what I used to make it do that: Func _p() $p = Not $p While $p Run("notepad.exe") WinWait("Untitled - Notepad") Local $hWnd = WinGetHandle("Untitled - Notepad") Local $sHWND = String($hWnd) ; Convert to a string ControlSend(HWnd($HWND), "", HWnd($HWND), "blah") Send("p") WEnd EndFunc So that made it open notepad and type blah in it. After I got it to do that I made it so it would minimize notepad then do controlsend, but it didn't work. So is there a way to make it send stuff to minimized programs? I know there is an easier way to do this then what I'm trying to do, but I just want to know if it's possible or not.
martin Posted March 24, 2007 Posted March 24, 2007 Earlier I was playing around with the Hwnd thing, and found out you can use it to send stuff to notepad as long as it's the active window. This is what I used to make it do that: Func _p() $p = Not $p While $p Run("notepad.exe") WinWait("Untitled - Notepad") Local $hWnd = WinGetHandle("Untitled - Notepad") Local $sHWND = String($hWnd) ; Convert to a string ControlSend(HWnd($HWND), "", HWnd($HWND), "blah") Send("p") WEnd EndFunc So that made it open notepad and type blah in it. After I got it to do that I made it so it would minimize notepad then do controlsend, but it didn't work. So is there a way to make it send stuff to minimized programs? I know there is an easier way to do this then what I'm trying to do, but I just want to know if it's possible or not. You can send to minimized applications. Try this Run("notepad.exe") WinWait("Untitled - Notepad") ControlSend("Untitled - Notepad", "","Edit1", "first line sent while window visible" & @CR) WinSetState("Untitled - Notepad",'',@SW_MINIMIZE) sleep(2000); ControlSend("Untitled - Notepad", "","Edit1", "Second line sent while minimised" & @CR) sleep(500) WinSetState("Untitled - Notepad",'',@SW_MAXIMIZE) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Zamp Posted March 24, 2007 Author Posted March 24, 2007 I know you can do it like that, but is there a way to do it using Hwnd? I'm not really trying to make anything right now, I just want to know this just for the fun of it
martin Posted March 24, 2007 Posted March 24, 2007 I know you can do it like that, but is there a way to do it using Hwnd? I'm not really trying to make anything right now, I just want to know this just for the fun of it It's the same thing - Run("notepad.exe") WinWait("Untitled - Notepad") $hWnd = WinGetHandle("Untitled - Notepad") ControlSend($hWnd, "","Edit1", "first line sent while window visible" & @CR) WinSetState("Untitled - Notepad",'',@SW_MINIMIZE) sleep(2000); ControlSend($hWnd, "","Edit1", "Second line sent while minimised" & @CR) sleep(500) WinSetState($hWnd,'',@SW_MAXIMIZE) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
_Kurt Posted March 24, 2007 Posted March 24, 2007 Perhaps look over this topic:http://www.autoitscript.com/forum/index.php?showtopic=7112That's for minimized clicking. I can't remember the other topic, but it showed how to send keystrokes to a minimized window. It involved a DllCall & more. Search around Good luck,Kurt Awaiting Diablo III..
Zamp Posted March 24, 2007 Author Posted March 24, 2007 Ok thanks martin. Also, how do you use the mouseclickplus thing? I tried using it before by copying that whole thing into my autoit script, then putting in the _Mouseclickplus(blahblahblah) but it didn't do the clicking it should have.
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