Jump to content

Get value of out combobox made from multidimensional array - (Moved)


Recommended Posts

Hey hey people,

Im pretty new to autoit and i got a assignment for my internship, which i've been stuck on for a few days.

i need to make a filename with data from  combobox (type) and 2 input fields, it should look something like this:

NL12345-2102463245-Badjas#00ff0d-Sweex#e5ff00.DST (the file is being made in Digitizer so .DST comes after the filename automatically)

image.png.18d3e5cc1924d939918143112b00ab9f.png

I can make most of the file name parts work accept the producttype, i did not create the orginal script myself, the intern before me did around 3 years ago.

things of note:

line 27: array that is used to make the combobox.

line 41-50: places the array elements into a list.

line 209: a test variable i made to make "product" appear in the filename.

line 307: the function that saves the filename.

 

There might be multiple problems but for now im focussed on the correct filename.

Beursmodule_v5_ben.au3

Link to post
Share on other sites
  • Moderators

Moved to the appropriate forum.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

Since this script is not runable for us, I would suggest that you create a replicable and runable snippet of your issue.  Make comments/names in english.  That way you will get a better chance to receive help.

Link to post
Share on other sites

 

It should'nt really matter which program it is being used on, my original question was: how do i get the selected value from the combobox "Type".

image.png.18d3e5cc1924d939918143112b00ab9f.png

This is where the GUI is made.

;-----THESE ARE THE TYPE COMBOBOX VALUES-----
;Waarde van Happy Horse 38 & 40 CM (standaard = 20)
Global $HH40 = 20 ; <-- DEZE WAARDE AANPASSEN
;Waarde van Happy Horse 58 CM (standaard = 25)
Global $HH58 = 25 ; <-- DEZE WAARDE AANPASSEN
;Waarde van de Badjas en Badcape (standaard = 30)
Global $BB = 30 ; <-- DEZE WAARDE AANPASSEN
;Waarde van de Knuffeldoekjes (standaard = 15 en op beurs 20)
Global $KD = 20 ; <-- DEZE WAARDE AANPASSEN
;Waarde van de Muziek knuffels (standaard = 15 )
Global $MK = 15 ; <-- DEZE WAARDE AANPASSEN
;-------------------------------------------

; Here is the array
Global $aArray[6][3] = [["Happy Horse 38 & 40", "80", "20"], ["Happy Horse 58", "115", "25"], ["Knuffeldoekjes", "80","20"], ["Badjas", "90", "30"], ["Badcape", "90", "30"], ["Muziek Knuffel", "80", "15"]]
; To add a product the array size needs to be changed and the product must be added ["naam", width, hoogte]
Global $bArray[3] = ["Editable", "Kids", "Amazone"]
Global $widthArray[10]
Global $heightArray[10]
Global $fontArray[10]
Global $textArray[10]
Global $orderArray[10]
Global $typeArray[10]
Global $arrayIndex = 0
Global $rowArray[72]

Global $isDigiRunning = false

; And here we get the elements into a list
$sList = ""
For $i = 0 To UBound($aArray,1) -1
    $sList &= "|" & $aArray[$i][0]
Next

$bList = ""
For $i = 0 To UBound($bArray) -1
    $bList &= "|" & $bArray[$i]
Next

; Create a GUI
#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Simply Digitizer", 800, 600)

; Create the combo
GUICtrlCreateLabel("Type", 10, 10, 30, 20)
GUICtrlCreateLabel("Font", 200, 10, 30, 20)
GUICtrlCreateLabel("Naam", 330, 10, 30, 20)
GUICtrlCreateLabel("Order", 480, 10, 30, 20)
$hCombo = GUICtrlCreateCombo("", 10, 30, 180, 50, $CBS_DROPDOWNLIST)
$bCombo = GUICtrlCreateCombo("", 200, 30, 110, 50, $CBS_DROPDOWNLIST)
$name = GUICtrlCreateInput("", 330, 30, 140, 30)
$order = GUICtrlCreateInput("", 480, 30, 60, 30)
GUICtrlSetFont($name, 14)
GUICtrlSetFont($order, 14)
GUICtrlSetFont($bCombo, 14)
GUICtrlSetFont($hCombo, 14)

GUICtrlSetData($hCombo, $sList)
GUICtrlSetData($bCombo, $bList)
Local $onoff = GUICtrlCreateLabel("", 600, 80, 30, 20)

; order label
Global $orderList = GUICtrlCreateList("", 10, 300, 480, 250)
GUICtrlSetFont($orderList, 15)

; Create label
$hLabel = GUICtrlCreateLabel("", 550, 30, 120, 20)

Local $start = GUICtrlCreateButton("Toevoegen", 640, 40, 150, 40)
Local $st = GUICtrlCreateButton("Start", 640, 550, 150, 40)

;all spacial chars
;rij 1
$rowArray[0] = GUICtrlCreateButton("À", 10, 90, 40, 30)
$rowArray[1] = GUICtrlCreateButton("È", 10, 120, 40, 30)
$rowArray[2] = GUICtrlCreateButton("Ì", 10, 150, 40, 30)
$rowArray[3] = GUICtrlCreateButton("Ò", 10, 180, 40, 30)
$rowArray[4] = GUICtrlCreateButton("Ù", 10, 210, 40, 30)
$rowArray[5] = GUICtrlCreateButton("€", 10, 240, 40, 30)

;rij 2
$rowArray[6] = GUICtrlCreateButton("à", 50, 90, 40, 30)
$rowArray[7] = GUICtrlCreateButton("è", 50, 120, 40, 30)
$rowArray[8] = GUICtrlCreateButton("ì", 50, 150, 40, 30)
$rowArray[9] = GUICtrlCreateButton("ò", 50, 180, 40, 30)
$rowArray[10] = GUICtrlCreateButton("ù", 50, 210, 40, 30)
$rowArray[11] = GUICtrlCreateButton("£", 50, 240, 40, 30)

;rij 3
$rowArray[12] = GUICtrlCreateButton("Á", 90, 90, 40, 30)
$rowArray[13] = GUICtrlCreateButton("É", 90, 120, 40, 30)
$rowArray[14] = GUICtrlCreateButton("Í", 90, 150, 40, 30)
$rowArray[15] = GUICtrlCreateButton("Ó", 90, 180, 40, 30)
$rowArray[16] = GUICtrlCreateButton("Ú", 90, 210, 40, 30)
$rowArray[17] = GUICtrlCreateButton("¥", 90, 240, 40, 30)

;rij 4
$rowArray[18] = GUICtrlCreateButton("á", 130, 90, 40, 30)
$rowArray[19] = GUICtrlCreateButton("é", 130, 120, 40, 30)
$rowArray[20] = GUICtrlCreateButton("í", 130, 150, 40, 30)
$rowArray[21] = GUICtrlCreateButton("ó", 130, 180, 40, 30)
$rowArray[22] = GUICtrlCreateButton("ú", 130, 210, 40, 30)
$rowArray[23] = GUICtrlCreateButton("ƒ", 130, 240, 40, 30)

;rij 5
$rowArray[24] = GUICtrlCreateButton("Â", 170, 90, 40, 30)
$rowArray[25] = GUICtrlCreateButton("Ê", 170, 120, 40, 30)
$rowArray[26] = GUICtrlCreateButton("Î", 170, 150, 40, 30)
$rowArray[27] = GUICtrlCreateButton("Ô", 170, 180, 40, 30)
$rowArray[28] = GUICtrlCreateButton("Û", 170, 210, 40, 30)
$rowArray[29] = GUICtrlCreateButton("¢", 170, 240, 40, 30)

;rij 6
$rowArray[30] = GUICtrlCreateButton("â", 210, 90, 40, 30)
$rowArray[31] = GUICtrlCreateButton("ê", 210, 120, 40, 30)
$rowArray[32] = GUICtrlCreateButton("î", 210, 150, 40, 30)
$rowArray[33] = GUICtrlCreateButton("ô", 210, 180, 40, 30)
$rowArray[34] = GUICtrlCreateButton("û", 210, 210, 40, 30)
$rowArray[35] = GUICtrlCreateButton("", 210, 240, 40, 30)

;rij 7
$rowArray[36] = GUICtrlCreateButton("Ã", 250, 90, 40, 30)
$rowArray[37] = GUICtrlCreateButton("", 250, 120, 40, 30)
$rowArray[38] = GUICtrlCreateButton("", 250, 150, 40, 30)
$rowArray[39] = GUICtrlCreateButton("Õ", 250, 180, 40, 30)
$rowArray[40] = GUICtrlCreateButton("ø", 250, 210, 40, 30)
$rowArray[41] = GUICtrlCreateButton("Ý", 250, 240, 40, 30)

;rij 8
$rowArray[42] = GUICtrlCreateButton("ã", 290, 90, 40, 30)
$rowArray[43] = GUICtrlCreateButton("", 290, 120, 40, 30)
$rowArray[44] = GUICtrlCreateButton("", 290, 150, 40, 30)
$rowArray[45] = GUICtrlCreateButton("õ", 290, 180, 40, 30)
$rowArray[46] = GUICtrlCreateButton("Ø", 290, 210, 40, 30)
$rowArray[47] = GUICtrlCreateButton("ý", 290, 240, 40, 30)

;rij 9
$rowArray[48] = GUICtrlCreateButton("Ä", 330, 90, 40, 30)
$rowArray[49] = GUICtrlCreateButton("Ë", 330, 120, 40, 30)
$rowArray[50] = GUICtrlCreateButton("Ï", 330, 150, 40, 30)
$rowArray[51] = GUICtrlCreateButton("Ö", 330, 180, 40, 30)
$rowArray[52] = GUICtrlCreateButton("Ü", 330, 210, 40, 30)
$rowArray[53] = GUICtrlCreateButton("Ÿ", 330, 240, 40, 30)

;rij 10
$rowArray[54] = GUICtrlCreateButton("ä", 370, 90, 40, 30)
$rowArray[55] = GUICtrlCreateButton("ë", 370, 120, 40, 30)
$rowArray[56] = GUICtrlCreateButton("ï", 370, 150, 40, 30)
$rowArray[57] = GUICtrlCreateButton("ö", 370, 180, 40, 30)
$rowArray[58] = GUICtrlCreateButton("ü", 370, 210, 40, 30)
$rowArray[59] = GUICtrlCreateButton("ÿ", 370, 240, 40, 30)

;rij 11
$rowArray[60] = GUICtrlCreateButton("İ", 410, 90, 40, 30)
$rowArray[61] = GUICtrlCreateButton("ı", 410, 120, 40, 30)
$rowArray[62] = GUICtrlCreateButton("Ñ", 410, 150, 40, 30)
$rowArray[63] = GUICtrlCreateButton("ñ", 410, 180, 40, 30)
$rowArray[64] = GUICtrlCreateButton("ß", 410, 210, 40, 30)
$rowArray[65] = GUICtrlCreateButton("å", 410, 240, 40, 30)

;rij 12
$rowArray[66] = GUICtrlCreateButton("Ç", 450, 90, 40, 30)
$rowArray[67] = GUICtrlCreateButton("ç", 450, 120, 40, 30)
$rowArray[68] = GUICtrlCreateButton("Ğ", 450, 150, 40, 30)
$rowArray[69] = GUICtrlCreateButton("ğ", 450, 180, 40, 30)
$rowArray[70] = GUICtrlCreateButton("Ş", 450, 210, 40, 30)
$rowArray[71] = GUICtrlCreateButton("ş", 450, 240, 40, 30)




Func isOn()
If ProcessExists("digitizer.exe") Then
   GUICtrlSetData($onoff, "ON")
   GUICtrlSetColor($onoff, $COLOR_GREEN)
   $isDigiRunning = true
Else
   GUICtrlSetData($onoff, "OFF")
   GUICtrlSetColor($onoff, $COLOR_RED)
   $isDigiRunning = false
EndIf
EndFunc

;dummy product for now
$productType = "product"

This is the function that is being used, but its mostly coordinates etc, not too relevant but good to add for context i think

Func startProcess()

   BlockInput($BI_DISABLE)
   For $i = 0 To $arrayIndex -1
   ;MsgBox($MB_SYSTEMMODAL, "Title", $textArray[$i], 15);
   ;Send("{ESC}")
   Call ("setReady")
   Sleep ("300")
   Call ("tabLettering", $fontArray[$i], $textArray[$i])
   Sleep ("1800")
   Call ("tabFill")
   Sleep ("400")
   Call ("setWidth", $widthArray[$i])
   Sleep ("400")
   Call ("setHeight", $typeArray[$i])
   Sleep ("400")
   Call ("remUnderlay")
   Sleep ("400")
   Call ("rotateObject", $typeArray[$i])
   Sleep("250")
   Call ("centerObject")
   Call ("saveFile", $orderArray[$i], $textArray[$i], $productType)
   Sleep("600")
   Send("{ENTER}")
   Sleep("500")
   Next
$arrayIndex = 0
_GUICtrlListBox_ResetContent($orderList)
WinActivate("[TITLE:Simply Digitizer]")
BlockInput($BI_ENABLE)
EndFunc

This is the part where i need the product type to make the file name/variable i want to use as a filename

Func saveFile($order, $input, $productType)
   Local $redGUI = $order
   Local $ordno = StringRight($redGUI, 5)
   ;Dummylocation
   Local $BSlocatie = "NL"
   ;Dummy ramping up number
   Local $BSoplopendNummer = 12345
   Local $product = $productType
   ;Dummy color 1
   Local $BSkleurEen = '#00ff0d'
   ;Dummycolor 2
   Local $BSkleurTwee = '#e5ff00'
   Local $devideName = '-'

   MouseClick($MOUSE_CLICK_LEFT, 32, 45)
   MouseClick($MOUSE_CLICK_LEFT, 105, 294)
   ;-----THIS IS THE FILENAME I WANT THE PRODUCT IN-----
   Send($BSlocatie & $BSoplopendNummer & $devideName & $ordno & $devideName & $product & $BSkleurEen & $devideName & $input & $BSkleurTwee, 1)
    ;---------------------------------------------------

   Local $currentDir = "Z:\plotten\Borduren\Orders\2021\02 Feb"
   ClipPut($currentDir)
   Sleep(300)
   MouseClick($MOUSE_CLICK_LEFT, 1598, 45)
   Sleep(300)
   Send("^v")
   Sleep(300)
   Send("{ENTER}")

   Sleep(300)
   ControlClick("Export Design", "", "Button3")
   Sleep(300)


EndFunc

I have already tried many things like _GUICtrlComboBox_GetCurSel and GUICtrlRead etc.

But i still could'nt get it to work, either it showed a 0 or it did not show the productType at all...

I tried to add some comment in english and remove some old code/reminders, it should still work/be readable by humans

I added the updated file for reference.

Beursmodule_v5_ben.au3

Link to post
Share on other sites

Hello,

You should read theses exemples :

GUICtrlCreateCombo ()
GUICtrlRead ()

In the help file.

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...