Jump to content

Concatenate and send to another window


Anub
 Share

Recommended Posts

Hello,

I tried to make a simple GUI that would speed up some laborious and boring task for a school project. i used Koda to design the interface but that's the limit of my understanding of coding.

Here is what I want it to do: I need to concatenate two strings of numbers to create a serial number of sorts for lab samples. The first half of the serial number is one of 3 options (lets say Part1A, Part1B, Part1C) and the second half is a number that I must input. After I select the first part from a drop down menu and I input the second half into the text box I want to click on the "Send to program" button and at that point the script combines both strings (e.g. Part1B00001) and paste it into a program. The program is set to receive input so the script needs to focus it and basically paste the concatenated string.

Unfortunately I have no idea how to do this and I barely have time to finish the lab work so I lack the time to tinker and learn how to code this (screaming easy) program.

 

Here is what I have so far:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Title", 218, 185, 727, 328)
$Part1 = GUICtrlCreateLabel("Part 1", 8, 8, 101, 27)
GUICtrlSetFont(-1, 14, 800, 0, "Calibri")
$Combo1 = GUICtrlCreateCombo("", 112, 8, 81, 27)
GUICtrlSetData(-1, "01|02|03")
$Label2 = GUICtrlCreateLabel("Part 2", 8, 48, 78, 27)
GUICtrlSetFont(-1, 14, 800, 0, "Calibri")
GUICtrlCreateInput("", 88, 48, 121, 21)
$Button1 = GUICtrlCreateButton("Send to program", 8, 88, 201, 81)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
WEnd

If anyone is willing to help me with this I would very much appreciate it.

Link to comment
Share on other sites

quick example:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Title", 218, 185, 727, 328)
$Part1 = GUICtrlCreateLabel("Part 1", 8, 8, 101, 27)
GUICtrlSetFont(-1, 14, 800, 0, "Calibri")
$Combo1 = GUICtrlCreateCombo("", 112, 8, 81, 27)
GUICtrlSetData(-1, "01|02|03")
$Label2 = GUICtrlCreateLabel("Part 2", 8, 48, 78, 27)
GUICtrlSetFont(-1, 14, 800, 0, "Calibri")
$input = GUICtrlCreateInput("", 88, 48, 121, 21) ; assigned a variable to this input so it can be read later.
$Button1 = GUICtrlCreateButton("Send to program", 8, 88, 201, 81)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $data1 = GUICtrlRead($Combo1)
            $data2 = GUICtrlRead($input)
            $concactenate = $data1 & $data2
            MsgBox(0, "Output", $concactenate)
    EndSwitch
WEnd

 

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...