Mhetto Garcus Posted April 19, 2006 Posted April 19, 2006 Help please. I am very new to the world of scripting let alone AutoIt. If someone can help me out that would be greatly appreciated. I am trying to create text output to the clip board. I have been looking at the help files. I have been looking at other scripts. I just dont get it. Below is a very remedial GUI I created. If someone could fill in the blanks to create the proper output for me I would be very grateful. GUI #include <GUIConstants.au3 $Form1 = GUICreate("Dog Cat", 196, 295, 192, 125) $Group1 = GUICtrlCreateGroup("Animal", 48, 16, 121, 89) $Radio1 = GUICtrlCreateRadio("Dog", 56, 40, 81, 17) $Radio2 = GUICtrlCreateRadio("Cat", 56, 64, 81, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Toy", 48, 128, 121, 81) $Radio3 = GUICtrlCreateRadio("Bone", 56, 144, 89, 25) $Radio4 = GUICtrlCreateRadio("String", 56, 176, 89, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Reset", 24, 240, 73, 41, 0) $Button2 = GUICtrlCreateButton("Copy", 112, 240, 73, 41, 0) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd The output would be The dog likes his bone or The cat likes his string etc Like I said this is very remedial, I am hoping to learn. Thank you to anyone that can help me. If I am posting in the wrong area please let me know.
Valuater Posted April 19, 2006 Posted April 19, 2006 maybe... expandcollapse popup#include <GUIConstants.au3> $Form1 = GUICreate("Dog Cat", 196, 295, 192, 125) $Group1 = GUICtrlCreateGroup("Animal", 48, 16, 121, 89) $Radio1 = GUICtrlCreateRadio("Dog", 56, 40, 81, 17) GUICtrlSetState( -1, $GUI_CHECKED) $Radio2 = GUICtrlCreateRadio("Cat", 56, 64, 81, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Toy", 48, 128, 121, 81) $Radio3 = GUICtrlCreateRadio("Bone", 56, 144, 89, 25) GUICtrlSetState( -1, $GUI_CHECKED) $Radio4 = GUICtrlCreateRadio("String", 56, 176, 89, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Reset", 24, 240, 73, 41, 0) $Button2 = GUICtrlCreateButton("Copy", 112, 240, 73, 41, 0) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button2 If BitAnd(GUICtrlRead($Radio1),$GUI_CHECKED) = $GUI_CHECKED Then $G1_info = "Dog" Else $G1_info = "Cat" EndIf If BitAnd(GUICtrlRead($Radio3),$GUI_CHECKED) = $GUI_CHECKED Then $G2_info = "Bone" Else $G2_info = "String" EndIf MsgBox(64, " Info read is...", $G1_info & " " & $G2_info & " ", 2) ClipPut($G1_info & " " & $G2_info) Case Else EndSelect WEnd 8)
Mhetto Garcus Posted April 19, 2006 Author Posted April 19, 2006 Thank you. That was what i was looking for. Kept making things way to complicated.
neogia Posted April 19, 2006 Posted April 19, 2006 (edited) In order to determine if a control has been activated, put "Case $msg = $ControlID" in your While Loop. After I determined that the "Start" button was pushed, I used GUICtrlRead() to determine the state of each of the radio buttons, and construct my string accordingly.expandcollapse popup#include <GUIConstants.au3> $Form1 = GUICreate("Dog Cat", 196, 295, 192, 125) $Group1 = GUICtrlCreateGroup("Animal", 48, 16, 121, 89) $Radio1 = GUICtrlCreateRadio("Dog", 56, 40, 81, 17) $Radio2 = GUICtrlCreateRadio("Cat", 56, 64, 81, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Toy", 48, 128, 121, 81) $Radio3 = GUICtrlCreateRadio("Bone", 56, 144, 89, 25) $Radio4 = GUICtrlCreateRadio("String", 56, 176, 89, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Reset", 24, 240, 73, 41, 0) $Button2 = GUICtrlCreateButton("Copy", 112, 240, 73, 41, 0) GUISetState(@SW_SHOW) $_GUI_CHECKED = BitAND($GUI_CHECKED, $GUI_ENABLE) $_GUI_UNCHECKED = BitAND($GUI_CHECKED, $GUI_ENABLE) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 GUICtrlSetState($Radio1, $GUI_UNCHECKED) GUICtrlSetState($Radio2, $GUI_UNCHECKED) GUICtrlSetState($Radio3, $GUI_UNCHECKED) GUICtrlSetState($Radio4, $GUI_UNCHECKED) Case $msg = $Button2 $string = "" If GUICtrlRead($Radio1) == $GUI_CHECKED Then $string &= "The Dog " ElseIf GUICtrlRead($Radio2) == $GUI_CHECKED Then $string &= "The Cat " EndIf If GUICtrlRead($radio3) == $GUI_CHECKED Then $string &= "likes his Bone." ElseIf GUICtrlRead($radio4) == $GUI_CHECKED Then $string &= "likes his String." EndIf ClipPut($string) MsgBox(0,"",$string) Case Else EndSelect WEndEdit: Hah! Waaaay too slow for Valuater. Edited April 19, 2006 by neogia [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia
Valuater Posted April 19, 2006 Posted April 19, 2006 Edit: Hah! Waaaay too slow for Valuater.yea... but, you did a nicer job too!8)
Mhetto Garcus Posted April 20, 2006 Author Posted April 20, 2006 Thanks you guys. I really appreciate it.
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