usera Posted February 17, 2012 Share Posted February 17, 2012 Please help me to understand Control Say, there are 3 notepad windows opened. in windows 1, it has "windows1" in notepad text body. in windows 2, it has "windows2" in notepad text body. in windows 3, it has "windows3" in notepad text body. Now, how can I use control function to get "windows2" notepad text body instead of windows1 or windows3, and typing more text behind "windows2" Thanks Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 17, 2012 Moderators Share Posted February 17, 2012 (edited) Hi, usera. You don't actually state what you want to do with the control. This would be a quick and dirty example of getting all three window handles... $var = ControlGetHandle("Untitled", "Windows 1", "Edit1") $var2 = ControlGetHandle("Untitled", "Windows 2", "Edit1") $var3 = ControlGetHandle("Untitled", "Windows 3", "Edit1") MsgBox(0, "", $var & " " & $var2 & " " & $var3) Edit: I think it is time to update my prescription. I missed the part about typing more text Edited February 17, 2012 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
water Posted February 17, 2012 Share Posted February 17, 2012 Use WinActivate to make the get the required window the active window: WinActivate("[CLASS:Notepad]", "windows2")then use Send to write some text. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
usera Posted February 17, 2012 Author Share Posted February 17, 2012 (edited) Use WinActivate to make the get the required window the active window: WinActivate("[CLASS:Notepad]", "windows2")then use Send to write some text. Thanks water, it works may I ask for little bit deep? Say if I have to use CONTROL function, how can I do that? in you code, you use "windows2" as text, what happend if the notepad body contain lots of text, let say over 2 pages, do i need put all of them here? usera Edited February 17, 2012 by usera Link to comment Share on other sites More sharing options...
water Posted February 17, 2012 Share Posted February 17, 2012 (edited) Use WinActivate("[CLASS:Notepad; INSTANCE:n]", "")to select the notepad window by instance number (starting with n = 1). Edited February 17, 2012 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
usera Posted February 17, 2012 Author Share Posted February 17, 2012 Use WinActivate("[CLASS:Notepad; INSTANCE:n]", "")to select the notepad window by instance number (starting with n = 1). Thanks water, how about use CONTROL Link to comment Share on other sites More sharing options...
water Posted February 17, 2012 Share Posted February 17, 2012 What do you mean by "Control"? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
usera Posted February 17, 2012 Author Share Posted February 17, 2012 What do you mean by "Control"?CONTROL, something like:ControlGetHandle("Untitled", "Windows 1", "Edit1") Link to comment Share on other sites More sharing options...
water Posted February 17, 2012 Share Posted February 17, 2012 If you have 3 notepad windows you have to find anything to keep them apart. Either by the window title, a text in any of the controls or by instance. I wouldn't insist on using any Control function but try to find an attribute to distinguish the windows. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
usera Posted February 17, 2012 Author Share Posted February 17, 2012 If you have 3 notepad windows you have to find anything to keep them apart.Either by the window title, a text in any of the controls or by instance.I wouldn't insist on using any Control function but try to find an attribute to distinguish the windows.in my example, only "windows1" "windows 2" "windows 3" which in the notepad text body different, is this the information as a "text" for CONTROL?do you mind give me the code for this example use CONTROL?thanks Link to comment Share on other sites More sharing options...
water Posted February 17, 2012 Share Posted February 17, 2012 How do you decide in which of the 3 windows you want to enter the additonal text? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
usera Posted February 17, 2012 Author Share Posted February 17, 2012 How do you decide in which of the 3 windows you want to enter the additonal text?Thanks, that is my question, somebody tell me sure use CONTROL, and I like to learn that just do not get idea how to use CONTROL Link to comment Share on other sites More sharing options...
water Posted February 17, 2012 Share Posted February 17, 2012 I fear I do not get the point. Is your goal to learn how to use the Control* functions (so your example with 3 notepads is purely hypothetical) or do you have a real problem and need to decide in which of the 3 notepad windows you need to enter text? If it is number 1 then I would suggest to select another example because the current is overly complicated. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted February 17, 2012 Share Posted February 17, 2012 (edited) Use WinActivate to make the get the required window the active window: WinActivate("[CLASS:Notepad]", "windows2")then use Send to write some text. usera What is wrong with this example? Just give the Winactivate() function a variable in which to hold the handle (hwnd) and use it as the first param in your Control* function. Edited February 17, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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