AppSoftwareVld Posted August 12, 2017 Posted August 12, 2017 Hello, I need this for a project and I don't find a method for the next problem. I want when I click a button to create a variable ("$variable1") so if I press one more time to create one more ("$variable2") and create more and more how many times you press the button. Do you have an idea ? Thank you for your attention !
Moderators Melba23 Posted August 12, 2017 Moderators Posted August 12, 2017 AppSoftwareVld, Welcome to the AutoIt forums. You could use an array and add an element each time you click the button. But if you could explain why you need to create these variables, we might be able to offer better solutions. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
AppSoftwareVld Posted August 12, 2017 Author Posted August 12, 2017 It's a bit difficult what I want to do, when the button click he will create a variable and set the variable some data. Actually, there is one more problem, probably I will open in another topic. After that I want to show on a list all variables that have a selected data (example show all variables with 'blue' data) or something like that. Sorry for my bad english, I hope you understood what I want to do.
Moderators Melba23 Posted August 12, 2017 Moderators Posted August 12, 2017 AppSoftwareVld, That is simply a repeat of what you want to do - I was asking why you wanted to do it, for example what type of data are you storing with each button press? If you were to use the array method I suggested then your second problem can be solved by searching through the array for the necessary "key" and then adding those elements to a List control. Again, if you can explain more clearly just what you are trying to do then I can offer more focused help. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
AppSoftwareVld Posted August 12, 2017 Author Posted August 12, 2017 I don't speak so good english, but all I want to do is when click the button read an input, create a new variable where that will have the text from the input and when i click on another button show a combo with all the variables that have the text 'blue'. I don't want to do nothing with them just show them in a combo. If you don't understand you can enter with team viewer if you have time to help for a moment and show you what I actually want to do, I can't explain so good in english.
Moderators Melba23 Posted August 12, 2017 Moderators Posted August 12, 2017 AppSoftwareVld, Does this do what you want? expandcollapse popup#include <GUIConstantsEx.au3> ; Array to hold input contents Global $aContents[1] = [0] ; Set required string to match $sRequired = "blue" ; Create GUI $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput("", 10, 10, 200, 20) $cRead = GUICtrlCreateButton("Read", 10, 50, 80, 30) $cShow = GUICtrlCreateButton("Show", 100, 50, 80, 30) $cCombo = GUICtrlCreateCombo("", 10, 100, 200, 200) GUICtrlSetState($cCombo, $GUI_HIDE) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cRead ; Increase size of array $aContents[0] += 1 ReDim $aContents[$aContents[0] + 1] ; Check if there is something to add If GUICtrlRead($cInput) <> "" Then ; Add input contents to array $aContents[$aContents[0]] = GUICtrlRead($cInput) EndIf ; Clear input GUICtrlSetData($cInput, "") ; Reset focus to input GUICtrlSetState($cInput, $GUI_FOCUS) Case $cShow ; Create new combo data $sComboData = "" ;Loop through array For $i = 1 To $aContents[0] ; Check if required value is present If StringInStr($aContents[$i], $sRequired) Then ; And add to combo data $sComboData &= "|" & $aContents[$i] EndIf Next ; Add data to combo GUICtrlSetData($cCombo, $sComboData) ; Show combo GUICtrlSetState($cCombo, $GUI_SHOW) Case $cCombo GUICtrlSetState($cCombo, $GUI_HIDE) EndSwitch WEnd M23 AppSoftwareVld 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
AppSoftwareVld Posted August 12, 2017 Author Posted August 12, 2017 Yes, this is what I searched for ! Thank you very much man !
Moderators Melba23 Posted August 12, 2017 Moderators Posted August 12, 2017 AppSoftwareVld, Glad I could help. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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