Autoyt443 Posted April 8, 2016 Share Posted April 8, 2016 On 4/6/2016 at 8:24 PM, Danny35d said: An example script of cascading combo box. #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> ; Create GUI GUICreate("Example Cascading ComboBox", 400, 296) $Combo1 = GUICtrlCreateCombo("", 2, 2, 396, 296) GUICtrlSetData($Combo1, "123|456|789|0") $Combo2 = GUICtrlCreateCombo("", 2, 30, 396, 296) GUISetState(@SW_SHOW) Global $cb1 = _GUICtrlComboBox_GetEditText($Combo1) Do $Msg = GUIGetMsg() Switch $Msg Case $Combo1 $cb1 = _GUICtrlComboBox_GetEditText($Combo1) _GUICtrlComboBox_ResetContent($Combo2) If $cb1 = "123" Then GUICtrlSetData($Combo2, "ABC|DEF") If $cb1 = "456" Then GUICtrlSetData($Combo2, "GHI|JKL") Case $Combo2 MsgBox($MB_SYSTEMMODAL, 'Information', 'ComboBox Selected Item: ' & _GUICtrlComboBox_GetEditText($Combo2)) EndSwitch Until $Msg = $GUI_EVENT_CLOSE GUIDelete() Link to comment Share on other sites More sharing options...
pranaynanda Posted April 8, 2016 Author Share Posted April 8, 2016 Yeah. Thanks. Now I need help with this new thing. Func _start($computer) Dim $sArray[1] $count = _GUICtrlListView_GetItemCount($ListView1) $aCount = 0 For $i = 1 To $count Step 1 If _GUICtrlListView_GetItemChecked($ListView1, $i-1) = True Then $sArray[$aCount]=_GUICtrlListView_GetItemText($ListView1, $i - 1, 1) ;MsgBox(0,"test",$sArray[$aCount]) ReDim $sArray[UBound($sArray) + 1] $aCount += 1 EndIf Next For $i = 1 To UBound($sArray) Step 1 MsgBox(4161,"Stopping Services",$sArray[$i]) Next ;If $mbox=1 Then ProgressOn("Stop services", "Stopping" & $sArray, "", -1, -1, 16) For $i = 1 To UBound($sArray) - 1 Step 1 $service = $sArray[$i - 1] RunWait("sc \\" & $computer & " stop " & '"' & $service & '"') ProgressSet($i / (UBound($sArray) - 1) * 100, Round($i / (UBound($sArray) - 1) * 100, 0) & "%", "Stopping " & $i & " of " & UBound($sArray) - 1) Next Sleep(5000) ProgressOff() _populate($machine) EndFunc I cannot get around to print the items that I've checked in the ListView to a message box separated by a line break. Link to comment Share on other sites More sharing options...
pranaynanda Posted April 8, 2016 Author Share Posted April 8, 2016 Also, two more things now, how do I color only the third column red? $Tab1 = GUICtrlCreateTab(0, 75, 675, 385,BitOR($TCS_BOTTOM,$TCS_RIGHTJUSTIFY,$TCS_MULTILINE)) GUICtrlSetState(-1, $GUI_SHOW) $TabSheet1 = GUICtrlCreateTabItem("Running Services") Global $ListView1 = GUICtrlCreateListView("Service Display Name|Service Name|Status", 2, 78, 670, 300, -1, BitOR($LVS_EX_GRIDLINES,$LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT)) GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 0, 300) GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 1, 288) GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 2, 88) $Button1 = GUICtrlCreateButton("Stop Services", 483, 392, 129, 33) Also, how do I call the authentication for systems my user account is not authorized for but a non-human service account is. Link to comment Share on other sites More sharing options...
pranaynanda Posted April 12, 2016 Author Share Posted April 12, 2016 (edited) @Danny35d I understand what you were saying. I cannot seem to understand why this is happening but _selectAll() and _UnselectAll() function work when the second tab stopped services tab is active but doesn't work when Running Services tab is active. Func _selectAll() _GUICtrlListView_SetItemChecked($ListView1, - 1, True) _GUICtrlListView_SetItemChecked($ListView2, - 1, True) EndFunc ;=>Select All Func _UnselectAll() _GUICtrlListView_SetItemChecked($ListView1, - 1, False) _GUICtrlListView_SetItemChecked($ListView2, - 1, False) EndFunc ;=> Unselect All As you said, the variables $ListView1 and $ListView2 are global now. Edited April 12, 2016 by pranaynanda Link to comment Share on other sites More sharing options...
Danny35d Posted April 12, 2016 Share Posted April 12, 2016 Only work with the second tab because you include all the menu items to the second tab. Move GUICtrlCreateTabItem("") between $Button2 and $MenuItem1 will fix the issue. $TabSheet2 = GUICtrlCreateTabItem("Stopped Services") GUICtrlSetState(-1,$GUI_SHOW) Global $ListView2 = GUICtrlCreateListView("Service Display Name|Service Name|Status", 2, 72, 670, 281, -1, BitOR($LVS_EX_GRIDLINES,$LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT)) GUICtrlSendMsg($ListView2, $LVM_SETCOLUMNWIDTH, 0, 300) GUICtrlSendMsg($ListView2, $LVM_SETCOLUMNWIDTH, 1, 288) GUICtrlSendMsg($ListView2, $LVM_SETCOLUMNWIDTH, 2, 88) $Button2 = GUICtrlCreateButton("Start Services", 464, 376, 129, 33) GUICtrlCreateTabItem("") $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem2 = GUICtrlCreateMenuItem("Select All", $MenuItem1) $MenuItem3 = GUICtrlCreateMenuItem("Unselect All", $MenuItem1) $MenuItem4 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem5 = GUICtrlCreateMenu("Help") $MenuItem6 = GUICtrlCreateMenuItem("Help Topics", $MenuItem5) $MenuItem7 = GUICtrlCreateMenuItem("About", $MenuItem5) GUISetState(@SW_SHOW) Now if you only want select all the items from the active tab make the following changes At the begging of the script add #include <GuiTab.au3> Make $Tab1 as a global variable Modify _selectAll() and _UnselectAll() functions Func _selectAll() If _GUICtrlTab_GetCurSel($Tab1) = 0 Then _GUICtrlListView_SetItemChecked($ListView1, - 1, True) Else _GUICtrlListView_SetItemChecked($ListView2, - 1, True) EndIf EndFunc Func _UnselectAll() If _GUICtrlTab_GetCurSel($Tab1) = 0 Then _GUICtrlListView_SetItemChecked($ListView1, - 1, False) Else _GUICtrlListView_SetItemChecked($ListView2, - 1, False) EndIf EndFunc AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
pranaynanda Posted April 13, 2016 Author Share Posted April 13, 2016 @Danny35d That worked! Thanks! Link to comment Share on other sites More sharing options...
ranhalt Posted August 16 Share Posted August 16 I reinvented the wheel here before I found this post, but I would be curious to see what this looks like compared to mine when mine is an inputbox to take a service name and start/stop buttons. Is this supposed to be a full list of all services with the ability to start/stop them? My problem to solve is to give users a way to manipulate services for vendor applications we sell to customers, but without admin rights for services.msc which is really just the entire MMC. I can elevate specific exes with another tool, so I can give my users the ability to start/stop services without having admin rights. Link to comment Share on other sites More sharing options...
ranhalt Posted August 18 Share Posted August 18 (edited) Hey this is pretty cool. Is there any way the services could be alphabetized? Edited August 18 by ranhalt Link to comment Share on other sites More sharing options...
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