rm4453 Posted August 9, 2016 Posted August 9, 2016 I need to find a way to after x amount of seconds set the Autoit gui's ComboBox to next option available, and if it reaches the end of the list start back at beginning. This way I can cycle through checking if users are connected to a network. The combo is populated via a recursive file search that contains folders with each connected user's username. The ComboBox will contain something like " username\config " for every connected user. So I need to make so it cycles through constantly every X seconds I have the gui functioning, and all that I just can't get this one part to work. TL:DR - How do I make so an AutoIt GUI ComboBox will cycle through all of its options every X seconds, and when it reaches bottom of options cycle back to top and continue the process again. Thanks! I can't post any code due to NDA sorry...
Moderators Melba23 Posted August 9, 2016 Moderators Posted August 9, 2016 rm4453, How about something along these lines: expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> ; List of combo contents Global $sList = "Alpha|Bravo|Charlie|Delta|Echo|Foxtrot" ;Convert to array $aList = StringSplit($sList, "|") $hGUI = GUICreate("Test", 500, 500) $cCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) ; Fill the combo _FillCombo() GUISetState() $nBegin = TimerInit() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; Every 2 seconds If TimerDiff($nBegin) > 2000 Then ; Refill the combo _FillCombo() ; Reset the timestamp $nBegin = TimerInit() EndIf WEnd Func _FillCombo() ; Index of array item to use as default Local Static $iIndex = 1 ; Set combo data with selected item as default GUICtrlSetData($cCombo, "|" & $sList, $aList[$iIndex]) ; increase index - and reset if required $iIndex += 1 If $iIndex > $aList[0] Then $iIndex = 1 EndIf EndFunc 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
rm4453 Posted August 9, 2016 Author Posted August 9, 2016 (edited) Thank You For Your Help. I was just about to post that i figured it out... Here is what I ended up using "at least what i can post of it" $CurrentAccount = GUICtrlRead($AccountSelect) $acc = _GUICtrlComboBox_GetCurSel($AccountSelect) Sleep(50) $timer = $timer + 50 If $go = 1 Then If $timer = $ConnectTimer * 60000 Then ProcessClose($pid) _GUICtrlComboBox_SetCurSel($AccountSelect, $acc + 1) If $acc = $accs + 1 Then _GUICtrlComboBox_SetCurSel($AccountSelect, 0) $acc = 0 EndIf $timer = 0 $copied = 0 EndIf EndIf $update = $update + 1 If $update = 25 Then _GUICtrlComboBox_SelectString($AccountSelect, $CurrentAccount) $update = 0 EndIf *EDIT : New Problem How would I Filecopy something If I only know parts of the file name... I need to grab the User Session info in a .config and for each user the first part is unique... I know that the last part is .config every time that is it... *EDIT: NEW PROB SOLVED I just set the filecopy to the dir with a *.config wildecard ... that should work for what I need due to it being only .config in the folder it would be copying from THANKS! ;=== CODE EXAMPLE FOR THOSE WHO COME LATER ON AND NEED THIS FileCopy(C:\example\Folders\*.config, $sDir, "1") ;=== ENJOY! Edited August 9, 2016 by rm4453 NEW PROB
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