Justen Posted December 11, 2008 Share Posted December 11, 2008 (edited) Hello I am wanting to use ControlSend in place of Send, but I always get an error wrong number of args. $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn Do Sleep(10) Until _IsPressed("01") Sleep(2000) Send(GUICtrlRead($file) & "") EndSelect WEnd EndFunc Thanks! Edited December 11, 2008 by Justen Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 12, 2008 Share Posted December 12, 2008 Hello I am wanting to use ControlSend in place of Send, but I always get an error wrong number of args. $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn Do Sleep(10) Until _IsPressed("01") Sleep(2000) Send(GUICtrlRead($file) & "") EndSelect WEnd EndFunc Thanks! So, you looked up ControlSend() in the help file, changed that line of the script and it looked like... what? You don't show your ControlSend() line here. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Justen Posted December 12, 2008 Author Share Posted December 12, 2008 So, you looked up ControlSend() in the help file, changed that line of the script and it looked like... what? You don't show your ControlSend() line here. Well that's the problem, I don't know how to replace Send with it. Whenever I do it gives an error. :\ I was hoping someone could show me how to use it with an example etc. Thanks. Link to comment Share on other sites More sharing options...
bo8ster Posted December 12, 2008 Share Posted December 12, 2008 Well that's the problem, I don't know how to replace Send with it. Whenever I do it gives an error. :\ I was hoping someone could show me how to use it with an example etc. Thanks.ControlSend("Untitled", "", "Edit1", "This is a line of text in the notepad window")Or get a control handle and put in there. Use the AutoIt Info window to get the information. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
Malkey Posted December 12, 2008 Share Posted December 12, 2008 (edited) Expanding bo8ster advice. The parameters for the ControlSend () command can be found using Au3Info.exe, a utility found in your root AutoIt3 directory. The parameter "title" of the window to access. You can use either the Title in quotes or the Window class as per example. When using Au3Info.exe this info is displayed in the top "Basic Window Info" group. And below that group is the "Basic Control Info". This is where the parameter "controlID" to interact with is found. As an example, when Notepad is active the "Basic Control Info" of Au3Info.exe displays Class: Edit and Instance 1 . So for ControlSend to a Notepad widow the controlID parameter is "Edit1" as per example. In the example, when the OK button is pressed the data in the input control is sent to a Notepad window if it exists, and, to the bottom output window of the Scite editor, if it exists. #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $file, $btn, $msg GUICreate(" My GUI input ", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES $file = GUICtrlCreateInput("", 10, 5, 300, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn If WinExists("[class:Notepad]") Then ;WinActivate("[class:Notepad]") ControlSend("[class:Notepad]", "", "Edit1", GUICtrlRead($file), 1) EndIf If WinExists("[class:SciTEWindow]") Then ;WinActivate("[class:SciTEWindow]") ControlSend("[class:SciTEWindow]", "", "Scintilla2", GUICtrlRead($file), 1) EndIf EndSelect WEnd EndFunc ;==>Example Edit: Changed If Then Edited December 12, 2008 by Malkey 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