Jump to content

Generate Button


Recommended Posts

Hey all I am new here so i apologize if i am placing the following in formation into the wrong section of the forum, I do not know AutoIT very well, I am looking for assistance on how to create a "generate and copy notes" button that will be able to gather all the information placed in either the input fields or checkbox fields and have it coppied to clipboard and then be able to paste it into notepad.

 

The following is the current code I am working with, I will be adding more fields i am wondering if someone can either do it for me and then explain to me what you did or explain to me on what to do, i have been all over youtube and the forums here and i have had no luck

 

any help please and thanks

 

include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\vince s\documents\sales note template.kxf
$Form1 = GUICreate("Sales Note Template", 824, 738, -1, -1)
$SalesAgentName = GUICtrlCreateLabel("Sales Agent Name", 72, 8, 132, 22)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
GUICtrlCreateInput("", 8, 88, 249, 21)
GUICtrlCreateLabel("Customer Full Name", 56, 64, 147, 22)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
GUICtrlCreateInput("", 8, 32, 249, 21)
$Label2 = GUICtrlCreateLabel("Customer E-Mail Address", 40, 120, 183, 22)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
GUICtrlCreateInput("", 8, 144, 249, 21)
$Input1 = GUICtrlCreateInput("", 8, 224, 121, 21)
$Input2 = GUICtrlCreateInput("", 136, 224, 121, 21)
$Label3 = GUICtrlCreateLabel("Customer Phone Number", 40, 176, 183, 22)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
$Label4 = GUICtrlCreateLabel("Primary", 48, 208, 38, 17)
$Label5 = GUICtrlCreateLabel("Secondary", 168, 208, 55, 17)
$Label6 = GUICtrlCreateLabel("Plan Purchased", 72, 256, 115, 22)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
GUICtrlCreateCombo("", 8, 288, 249, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "1 Year Repair Service|1 Time Repair Service|Six Month Repair Service|Software Install Only")
$Label8 = GUICtrlCreateLabel("Total Amount Paid", 56, 512, 132, 22)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
GUICtrlCreateInput("$", 56, 536, 121, 21)
$Label7 = GUICtrlCreateLabel("Software Purchased", 56, 320, 147, 22)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
GUICtrlCreateCombo("", 8, 352, 249, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Life Time Stopzilla|1 Year Stopzilla |No AV Purchased")
$Label9 = GUICtrlCreateLabel("Computers Signed Up", 48, 440, 160, 22)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
GUICtrlCreateCheckbox("1 PC", 24, 472, 49, 17)
$Checkbox1 = GUICtrlCreateCheckbox("2 PC", 104, 472, 57, 17)
$Checkbox2 = GUICtrlCreateCheckbox("3 PC", 176, 472, 49, 17)
$Label10 = GUICtrlCreateLabel("Operating System", 64, 384, 130, 22)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
GUICtrlCreateCombo("", 8, 408, 249, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Windows|Mac")
$Button1 = GUICtrlCreateButton("Generate Notes", 24, 584, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

 

Link to comment
Share on other sites

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Moderators

First off, it will help you immensely to begin organizing your code. It'll be easier for you to read and debug, as well as anyone assisting you. For GUIs I tend to group controls together like so:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\vince s\documents\sales note template.kxf

$Form1 = GUICreate("Sales Note Template", 824, 738, -1, -1)
    GUISetFont(-1, 11, 800, 0, "Arial")
$SalesAgentName = GUICtrlCreateLabel("Sales Agent Name", 72, 8, 132, 22)

;Labels:
GUICtrlCreateLabel("Customer Full Name", 56, 64, 147, 22)
$Label2 = GUICtrlCreateLabel("Customer E-Mail Address", 40, 120, 183, 22)
$Label3 = GUICtrlCreateLabel("Customer Phone Number", 40, 176, 183, 22)
$Label4 = GUICtrlCreateLabel("Primary", 48, 208, 38, 17)
$Label5 = GUICtrlCreateLabel("Secondary", 168, 208, 55, 17)
$Label6 = GUICtrlCreateLabel("Plan Purchased", 72, 256, 115, 22)
$Label7 = GUICtrlCreateLabel("Software Purchased", 56, 320, 147, 22)
$Label8 = GUICtrlCreateLabel("Total Amount Paid", 56, 512, 132, 22)
$Label9 = GUICtrlCreateLabel("Computers Signed Up", 48, 440, 160, 22)
$Label10 = GUICtrlCreateLabel("Operating System", 64, 384, 130, 22)

;Inputs
$Input1 = GUICtrlCreateInput("", 8, 88, 249, 21)
$Input2 = GUICtrlCreateInput("", 8, 32, 249, 21)
$Input3 = GUICtrlCreateInput("", 8, 144, 249, 21)
$Input4 = GUICtrlCreateInput("", 8, 224, 121, 21)
$Input5 = GUICtrlCreateInput("", 136, 224, 121, 21)
$Input6 = GUICtrlCreateInput("$", 56, 536, 121, 21)

;Combo Boxes
GUICtrlCreateCombo("", 8, 288, 249, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "1 Year Repair Service|1 Time Repair Service|Six Month Repair Service|Software Install Only")
GUICtrlCreateCombo("", 8, 352, 249, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Life Time Stopzilla|1 Year Stopzilla |No AV Purchased")
GUICtrlCreateCombo("", 8, 408, 249, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Windows|Mac")

;CheckBoxes

GUICtrlCreateCheckbox("1 PC", 24, 472, 49, 17)
$Checkbox1 = GUICtrlCreateCheckbox("2 PC", 104, 472, 57, 17)
$Checkbox2 = GUICtrlCreateCheckbox("3 PC", 176, 472, 49, 17)

;Buttons
$Button1 = GUICtrlCreateButton("Generate Notes", 24, 584, 75, 25)
$Button2 = GUICtrlCreateButton("Copy Notes", 124, 584, 175, 25)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

 

Regarding your issue, you've already created one button, so creating and placing a second should not be an issue. You then use GUICtrlRead to get the value of whatever controls you want to read. Like so:

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            $ouput = GUICtrlRead($Input1) & @CRLF & _
                GUICtrlRead($Input2) & @CRLF & _
                GUICtrlRead($Input3) & @CRLF ;...etc. etc. you get the idea


            ClipPut($ouput)
            ConsoleWrite(ClipGet() & @CRLF) ;so you can see it is on the clipboard.
    EndSwitch

WEnd

 

Also, as a bit constructive criticism, you assigned variable names to all of your labels, but not all of your other controls. If you are not going to change the name of the label, you usually don't have to bother with assigning it a variable name. For other controls, such as input fields and checkboxes, you do want to assign a variable, so you can interact with it later on.

Once you get more familiar with creating and getting info from a GUI, you'll find there are easier ways to declare and interact with the controls that will lead to fewer lines (such as declaring all of your input boxes through an array and then looping through it to read all the values). But this should get you started for the moment.

Edited 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

I personally would also use more descriptive names for your inputs, but if you are going to only use them once, no big deal, but it is easier to name variables with names of what they do, so for instance my input boxes might all start with $CustNameInput, $CustEmailInput or $InputCustName, $InputCustEmail.

 

 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

That's because you have your inputs in the wrong place for what you think they're intended for. You created the Sales Agent Name input at 8,88 and the customer name at 8,32 those two should be reversed. This is why you should name your variables/controls better so you can track what is happening in your script..

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

okay thank you for the information, i am working on that better now i am re-doing this one line at a time just one more quick bit of assistance

the code that i have in red, it is working the way i want but i can't figure out the space code to put a space in between?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Vince S\Documents\Form2.kxf
$Form2 = GUICreate("Form2", 615, 503, 193, 122)
$AgentName = GUICtrlCreateLabel("Sales Agent Name:", 72, 88, 92, 17)
$InputAgentName = GUICtrlCreateInput("", 72, 136, 121, 21)
$Generate = GUICtrlCreateButton("Save And Copy Notes", 88, 248, 147, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Generate
                $output = GUICtrlRead($AgentName) & @CRLF & GUICtrlRead($InputAgentName)

                ClipPut($output)
                ConsoleWrite(ClipGet() & @CRLF)

    EndSwitch
WEnd

 

Link to comment
Share on other sites

Okay i figured out the spacing that I wanted to do, now i'm running into my next problem

I want the results to look like this

Sales Agent Name:  john smith

Customer Full Name: John smith

 

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

            case $CopyNotes
                $output = GUICtrlRead($SalesAgentName) &  GUICtrlRead($InputAgentName)
                $output = GUICtrlRead($CustomerFullName) & GUICtrlRead($InputCustomerName)
                $output = GUICtrlRead($CustomerEmailAdd) & GUICtrlRead($InputCustomerEmailAdd)
                $output = GUICtrlRead($CustomerNumber) & GUICtrlRead($PrimaryNumber & $SecondaryNumber)
                $output = GUICtrlRead($PlanPurchased) & GUICtrlRead($SelectPlan)
                $output = GUICtrlRead($softwarepurchased) & GUICtrlRead($SelectSoftware)
                $output = GUICtrlRead($OperatingSystem) & GUICtrlRead($SelectOperatingSystem)
                $output = GUICtrlRead($ComputersSignedUp) & GUICtrlRead($Checkbox1)
                $output = GUICtrlRead($TotalAmountPaid) & GUICtrlRead($InputAmountPaid)

                ClipPut($output)
                ConsoleWrite(ClipGet() & @CRLF)

    EndSwitch
WEnd

 

Link to comment
Share on other sites

I have even tried to write it up like this to see if this is the fix and still nothing

 

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

            case $CopyNotes
                $output = GUICtrlRead($SalesAgentName) & GUICtrlRead($InputAgentName)
                $output2 = GUICtrlRead($CustomerFullName) & GUICtrlRead($InputCustomerName)
                $output3 = GUICtrlRead($CustomerEmailAdd) & GUICtrlRead($InputCustomerEmailAdd)
                $output4 = GUICtrlRead($CustomerNumber) & GUICtrlRead($PrimaryNumber & $SecondaryNumber)
                $output5 = GUICtrlRead($PlanPurchased) & GUICtrlRead($SelectPlan)
                $output6 = GUICtrlRead($softwarepurchased) & GUICtrlRead($SelectSoftware)
                $output7 = GUICtrlRead($OperatingSystem) & GUICtrlRead($SelectOperatingSystem)
                $output8 = GUICtrlRead($ComputersSignedUp) & GUICtrlRead($Checkbox1)
                $output9 = GUICtrlRead($TotalAmountPaid) & GUICtrlRead($InputAmountPaid)

                ClipPut($output)
                ConsoleWrite(ClipGet() & @CRLF)
                ClipPut($output2)
                ConsoleWrite(ClipGet() & @CRLF)
                ClipPut($output3)
                ConsoleWrite(ClipGet() & @CRLF)
                ClipPut($output4)
                ConsoleWrite(ClipGet() & @CRLF)
                ClipPut($output5)
                ConsoleWrite(ClipGet() & @CRLF)
                ClipPut($output6)
                ConsoleWrite(ClipGet() & @CRLF)
                ClipPut($output7)
                ConsoleWrite(ClipGet() & @CRLF)
                ClipPut($output8)
                ConsoleWrite(ClipGet() & @CRLF)
                ClipPut($output9)
                ConsoleWrite(ClipGet() & @CRLF)

    EndSwitch
WEnd

 

Link to comment
Share on other sites

Try this instead:

$output = GUICtrlRead($SalesAgentName) & ' ' & GUICtrlRead($InputAgentName) & @CRLF
                $output &= GUICtrlRead($CustomerFullName) & ' ' & GUICtrlRead($InputCustomerName) & @CRLF
                $output &= GUICtrlRead($CustomerEmailAdd) & ' ' & GUICtrlRead($InputCustomerEmailAdd) & @CRLF
                $output &= GUICtrlRead($CustomerNumber) & ' ' & GUICtrlRead($PrimaryNumber & $SecondaryNumber) & @CRLF
                $output &= GUICtrlRead($PlanPurchased) & ' ' & GUICtrlRead($SelectPlan) & @CRLF
                $output &= GUICtrlRead($softwarepurchased) & GUICtrlRead($SelectSoftware) & @CRLF
                $output &= GUICtrlRead($OperatingSystem) & ' ' & GUICtrlRead($SelectOperatingSystem) & @CRLF
                $output &= GUICtrlRead($ComputersSignedUp) & ' ' & GUICtrlRead($Checkbox1) & @CRLF
                $output &= GUICtrlRead($TotalAmountPaid) & ' ' & GUICtrlRead($InputAmountPaid)

                ClipPut($output)
                ConsoleWrite(ClipGet() & @CRLF)

 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Okay everything is working perfectly, just one thing i have to work on and i'm not sure on how to do it i have 3 check boxes and i'm trying to have it read either or so if it reads 1 pc it gets that info or if its checked for 2 pc etc

$output &= GUICtrlRead($ComputersSignedUp) & ' ' & GUICtrlRead($Checkbox1) & @CRLF

I even tried the following commands

$output &= GUICtrlRead($ComputersSignedUp) & ' ' & GUICtrlRead($Checkbox1), GUICtrlRead($Checkbox2), GUICtrlRead($Checkbox3) & @CRLF

 

$output &= GUICtrlRead($ComputersSignedUp) & ' ' & GUICtrlRead($Checkbox1 & ' ' & $Checkbox2 & ' ' & $Checkbox3) & @CRLF

I'm at a loss

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Vince S\Documents\Form2.kxf
$Form2 = GUICreate("Form1", 820, 738, 801, 93)
$SalesAgentName = GUICtrlCreateLabel("Sales Agent Name: ", 56, 8, 124, 21)
GUICtrlSetFont(-1, 11, 800, 0, "Times New Roman")
$InputAgentName = GUICtrlCreateInput("", 8, 32, 249, 21)
$CustomerFullName = GUICtrlCreateLabel("Customer Full Name: ", 48, 64, 140, 21)
GUICtrlSetFont(-1, 11, 800, 0, "Times New Roman")
$InputCustomerName = GUICtrlCreateInput("", 8, 88, 249, 21)
$CustomerEmailAdd = GUICtrlCreateLabel("Customer E-Mail Address: ", 32, 120, 177, 21)
GUICtrlSetFont(-1, 11, 800, 0, "Times New Roman")
$InputCustomerEmailAdd = GUICtrlCreateInput("", 8, 144, 249, 21)
$CustomerNumber = GUICtrlCreateLabel("Customer Phone Number: ", 48, 176, 171, 21)
GUICtrlSetFont(-1, 11, 800, 0, "Times New Roman")
$PrimaryNumber = GUICtrlCreateLabel("Primary: ", 48, 208, 38, 17)
$SecondaryNumber = GUICtrlCreateLabel("Secondary: ", 168, 208, 55, 17)
$InputCustomerPNumber = GUICtrlCreateInput("", 8, 224, 121, 21)
$InputCustomerSNumber = GUICtrlCreateInput("", 136, 224, 121, 21)
$PlanPurchased = GUICtrlCreateLabel("Plan Purchased: ", 80, 256, 104, 21)
GUICtrlSetFont(-1, 11, 800, 0, "Times New Roman")
$SelectPlan = GUICtrlCreateCombo("", 8, 280, 249, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "1 Year Repair Service|1 Time Repair Service|Six Month Repair Service|Software Install Only")
$softwarepurchased = GUICtrlCreateLabel("Software Purchased: ", 72, 312, 132, 21)
GUICtrlSetFont(-1, 11, 800, 0, "Times New Roman")
$SelectSoftware = GUICtrlCreateCombo("", 8, 336, 249, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Life Time Stopzilla|1 Year Stopzilla |No AV Purchased")
$OperatingSystem = GUICtrlCreateLabel("Operating System: ", 80, 368, 121, 21)
GUICtrlSetFont(-1, 11, 800, 0, "Times New Roman")
$SelectOperatingSystem = GUICtrlCreateCombo("", 8, 392, 249, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Windows|MAC")
$ComputersSignedUp = GUICtrlCreateLabel("Computers Signed Up: ", 64, 424, 148, 21)
GUICtrlSetFont(-1, 11, 800, 0, "Times New Roman")
$Checkbox1 = GUICtrlCreateCheckbox("1 PC", 40, 456, 49, 17)
$Checkbox2 = GUICtrlCreateCheckbox("2 PC", 120, 456, 49, 17)
$Checkbox3 = GUICtrlCreateCheckbox("3 PC", 192, 456, 49, 17)
$TotalAmountPaid = GUICtrlCreateLabel("Total Amount Paid: ", 80, 488, 126, 21)
GUICtrlSetFont(-1, 11, 800, 0, "Times New Roman")
$InputAmountPaid = GUICtrlCreateInput("$", 80, 520, 121, 21)
$CopyNotes = GUICtrlCreateButton("Copy Notes", 8, 560, 91, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

 

 

Link to comment
Share on other sites

I am not at a computer, but look at examples for radiobuttons - unless you want more than one checked. 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Go with radio button then, as otherwise you will not know which checkbox is the one wanted, as more than one can be checked, with radio, only one can be in a set. 

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • 2 weeks later...

I have the following code i've been working on however it is not reading right

the resutls are coming up as follows

 

Computers Signed Up 4 (this is what happens when i select the radio selection for pc 2 or pc 3

 

$SelectPC1 = GUICtrlCreateRadio("1 PC", 48, 456, 49, 17)
$SelectPC2 = GUICtrlCreateRadio("2 PC", 120, 456, 49, 17)
$SelectPC3 = GUICtrlCreateRadio("3 PC", 184, 456, 49, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

            case $CopyNotes
                $output = GUICtrlRead($SalesAgentName) & ' ' & GUICtrlRead($InputAgentName) & @CRLF
                $output &= GUICtrlRead($CustomerFullName) & ' ' & GUICtrlRead($InputCustomerName) & @CRLF
                $output &= GUICtrlRead($CustomerEmailAdd) & ' ' & GUICtrlRead($InputCustomerEmailAdd) & @CRLF
                $output &= GUICtrlRead($PrimaryNumber) & ' ' & GUICtrlRead($InputCustomerPNumber) & @CRLF
                $output &= GUICtrlRead($SecondaryNumber) & ' ' & GUICtrlRead($InputCustomerSNumber) & @CRLF
                $output &= GUICtrlRead($PlanPurchased) & ' ' & GUICtrlRead($SelectPlan) & @CRLF
                $output &= GUICtrlRead($softwarepurchased) & GUICtrlRead($SelectSoftware) & @CRLF
                $output &= GUICtrlRead($OperatingSystem) & ' ' & GUICtrlRead($SelectOperatingSystem) & @CRLF
                $output &= GUICtrlRead($ComputersSignedUp) & ' ' & GUICtrlRead($SelectPC1)  & @CRLF
                $output &= GUICtrlRead($TotalAmountPaid) & ' ' & GUICtrlRead($InputAmountPaid)

                ClipPut($output)
                ConsoleWrite(ClipGet() & @CRLF)

            Case $SelectPC1
                If GUICtrlRead($SelectPC1) = 1 Then

                EndIf

    Case $SelectPC2
        If GUICtrlRead($SelectPC2) = 2 Then
            EndIf




    EndSwitch
WEnd

 

Link to comment
Share on other sites

  • Moderators

You need to re-read the help file for GUICtrlRead; for a RadioButton, it reads the STATE of the button (1 for $GUI_CHECKED, 4 for $GUI_UNCHECKED). Just because you assign a label 1, 2, 3 to your radio buttons doesn't mean that label will be read. You need to work that into your logic. Something like this:

If GUICtrlRead($SelectPC1) = 1 Then
                ConsoleWrite("You selected radio button 1!" & @CRLF)
            ElseIf GUICtrlRead($SelectPC2) = 1 Then
                ConsoleWrite("You selected radio button 2!" & @CRLF)
            ElseIf GUICtrlRead($SelectPC3) = 1 Then
                ConsoleWrite("You selected radio button 3!" & @CRLF)
            Else
                ConsoleWrite("Error! No radio buttons selected!" & @CRLF)
            EndIf

 

"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

Is there any way i can make that code into this format

I want to be able to select 1 pc and then have it out put to the output field for computers signed up

same with 2pc and 3 pc

 

Sales Agent Name
Customer Full Name
Customer E-Mail Address
Primary
Secondary
Plan Purchased
Software Purchased
Operating System
Computers Signed Up 1
Total Amount Paid $

 

 

Link to comment
Share on other sites

  • Moderators

If GUICtrlRead($SelectPC1) = 1 Then
                $PCsPurchased = 1
            ElseIf GUICtrlRead($SelectPC2) = 1 Then
                $PCsPurchased = 2
            ElseIf GUICtrlRead($SelectPC3) = 1 Then
                $PCsPurchased = 3
            Else
                ConsoleWrite("Error! No radio buttons selected!" & @CRLF)
            EndIf
            
                $output = GUICtrlRead($SalesAgentName) & ' ' & GUICtrlRead($InputAgentName) & @CRLF
                $output &= GUICtrlRead($CustomerFullName) & ' ' & GUICtrlRead($InputCustomerName) & @CRLF
                $output &= GUICtrlRead($CustomerEmailAdd) & ' ' & GUICtrlRead($InputCustomerEmailAdd) & @CRLF
                $output &= GUICtrlRead($PrimaryNumber) & ' ' & GUICtrlRead($InputCustomerPNumber) & @CRLF
                $output &= GUICtrlRead($SecondaryNumber) & ' ' & GUICtrlRead($InputCustomerSNumber) & @CRLF
                $output &= GUICtrlRead($PlanPurchased) & ' ' & GUICtrlRead($SelectPlan) & @CRLF
                $output &= GUICtrlRead($softwarepurchased) & GUICtrlRead($SelectSoftware) & @CRLF
                $output &= GUICtrlRead($OperatingSystem) & ' ' & GUICtrlRead($SelectOperatingSystem) & @CRLF
                $output &= GUICtrlRead($ComputersSignedUp) & ' ' & $PCsPurchased & @CRLF
                $output &= GUICtrlRead($TotalAmountPaid) & ' ' & GUICtrlRead($InputAmountPaid)

 

"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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...