Bert Posted September 14, 2005 Posted September 14, 2005 (edited) I made a combo box to allow the user to select the choice they like, then when they click ok, the selection will be sent to the edit field in the application they are using. I get the choices to show up in the drop down, and I can select the one I wish. The proble is when I click ok, the information is not sent to the edit field of the application? I'm stumped. Here is the code: fileopen ("bucket.ini", 0) $note1 = FileReadLine ("bucket.ini") ;------------------------------------- #include <GuiConstants.au3> GUICreate("Bucket Name", 300, 75) $Combo_2 = GuiCtrlCreateCombo("", 20, 20, 200, 21) GuiCtrlSetData($combo_2, $note1) $button1 = GuiCtrlCreateButton("OK", 230, 20, 60, 20) ; Run the GUI until it is closed GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop ;When button is pressed, information is copied to ;edit field in ticket Case $msg = $button1 $data = GUICtrlRead($Combo_2) $Label_1 = Send($data, 1) GuiCtrlSetData($Label_1, $data) exit EndSelect WEnd Exit Edited September 14, 2005 by Larry The Vollatran project My blog: http://www.vollysinterestingshit.com/
Developers Jos Posted September 14, 2005 Developers Posted September 14, 2005 At the time you do the Send() command your GUI probably still has the focus. Can't you work with ControlSend() and specify the correct Edit control in the correct window ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Bert Posted September 14, 2005 Author Posted September 14, 2005 Is it possible to have the drop down box close, which returns the focus to the app, then post the information? The Vollatran project My blog: http://www.vollysinterestingshit.com/
Moderators SmOke_N Posted September 14, 2005 Moderators Posted September 14, 2005 Actually, with $Label_1, you've never created an Edit Box. If you create the edit box you don't need send, just the GUICtrlSetData(). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Bert Posted September 14, 2005 Author Posted September 14, 2005 I'm somewhat confused. Is it possible to fix the code and repost it? The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted September 14, 2005 Author Posted September 14, 2005 The edit box is in the application, not in my script. My goal is to provide some choices, and have the choice selected sent to the application's edit field via the send command. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Developers Jos Posted September 14, 2005 Developers Posted September 14, 2005 The edit box is in the application, not in my script. My goal is to provide some choices, and have the choice selected sent to the application's edit field via the send command.<{POST_SNAPBACK}>As said.. try using ControlSend() ... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Moderators SmOke_N Posted September 14, 2005 Moderators Posted September 14, 2005 (edited) As said.. try using ControlSend() ...<{POST_SNAPBACK}>Oops, ^^^ that should work Edit:Example,$data = GUICtrlRead($Combo_2)ControlSend("My Application Title", "", "Control ID from AutoInfo Tool of Edit Box to Send To", $data) Edited September 14, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Bert Posted September 15, 2005 Author Posted September 15, 2005 small problem with the solution: The window name can change depending on which function the user is performing. The best way I can explain how this program works is its like the clipboard function, except the user only has certain choices, and once the user picks what they want, the information is pasted to the application. I'll try your solution tomorrow. Maybe I can figure out a variable that will work. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Moderators SmOke_N Posted September 15, 2005 Moderators Posted September 15, 2005 (edited) How about the Class? AutoInfo: Title: Untitled - Notepad Class: Notepad Example: Opt("WinTitleMatchMode", 4) Run("Notepad.exe") Sleep(1000) $HANDLE = WinGetHandle("classname=Notepad") ControlSend($HANDLE, "", "Edit1", $data) Just replace the: WinGetHandle("classname=YOUR_CLASS_FROM_THE_APPLICATION") ControlSend($HANDLE, "", "YOUR_CONTROL_ID_FROM_EDIT_BOX", $data) Edit: Fixed typo Edited September 15, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Bert Posted September 15, 2005 Author Posted September 15, 2005 I got to thinking about the focus problem, and I realized I could simply use clipPut to put the information to the clipboard. Then have it pasted to the edit field in the application. I should have it ready in a while. I will post my code when I get it working. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted September 15, 2005 Author Posted September 15, 2005 I got it working. This is the code: ;I will need to cut and paste the information from the below listed file here #include <GuiConstants.au3> ;----------------------------- fileopen ("bucket.ini", 0) $note1 = FileReadLine ("bucket.ini") GUICreate("Bucket Name", 300, 75) $Combo_2 = GuiCtrlCreateCombo("", 20, 20, 200, 21) GuiCtrlSetData($combo_2, $note1) $button1 = GuiCtrlCreateButton("OK", 230, 20, 60, 20) ; Run the GUI until it is closed GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop ;When button is pressed, label text is copied to the clipboard Case $msg = $button1 $data = GUICtrlRead($Combo_2) ClipPut($data) exit EndSelect WEnd Exit The Vollatran project My blog: http://www.vollysinterestingshit.com/
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