byoda Posted June 24, 2010 Share Posted June 24, 2010 I have created a dialog box that appears at the beginning of the script and terminated at the end. Func Progress() GUICreate ("Progress", 300, 50) GUICtrlCreateLabel("In Progress"), 30, 10) GuiSetState(@SW_SHOW) EndFunc I would like to display the current running function or call in the progress bar. For Example Read() Write() Log() *************************************** In Progress 1. Read function is currently running 2. Write function is currently running **************************************** I am not sure where to start. Thanks. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 24, 2010 Moderators Share Posted June 24, 2010 byoda, Does this give you some ideas? expandcollapse popup#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hLabel = GUICtrlCreateLabel("", 10, 10, 480, 40) GUICtrlSetFont(-1, 18) $hButton_Read = GUICtrlCreateButton("Read", 10, 100, 80, 30) $hButton_Write = GUICtrlCreateButton("Write", 10, 140, 80, 30) $hButton_Log = GUICtrlCreateButton("Log", 10, 180, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton_Read _Read() Case $hButton_Write _Write() Case $hButton_Log _Log() EndSwitch WEnd Func _Read() GUICtrlSetData($hLabel, "Read function is currently running...") Sleep(2000) GUICtrlSetData($hLabel, "") EndFunc Func _Write() GUICtrlSetData($hLabel, "Write function is currently running...") Sleep(2000) GUICtrlSetData($hLabel, "") EndFunc Func _Log() GUICtrlSetData($hLabel, "Log function is currently running...") Sleep(2000) GUICtrlSetData($hLabel, "") 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 Link to comment Share on other sites More sharing options...
byoda Posted June 24, 2010 Author Share Posted June 24, 2010 byoda, Does this give you some ideas? expandcollapse popup#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hLabel = GUICtrlCreateLabel("", 10, 10, 480, 40) GUICtrlSetFont(-1, 18) $hButton_Read = GUICtrlCreateButton("Read", 10, 100, 80, 30) $hButton_Write = GUICtrlCreateButton("Write", 10, 140, 80, 30) $hButton_Log = GUICtrlCreateButton("Log", 10, 180, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton_Read _Read() Case $hButton_Write _Write() Case $hButton_Log _Log() EndSwitch WEnd Func _Read() GUICtrlSetData($hLabel, "Read function is currently running...") Sleep(2000) GUICtrlSetData($hLabel, "") EndFunc Func _Write() GUICtrlSetData($hLabel, "Write function is currently running...") Sleep(2000) GUICtrlSetData($hLabel, "") EndFunc Func _Log() GUICtrlSetData($hLabel, "Log function is currently running...") Sleep(2000) GUICtrlSetData($hLabel, "") EndFunc M23 I understand, but how would i integrate these functions into my allready existing functions? Here is a function that I am calling and want to show status. Thank you. Func Winrm() CmdLog("winrm e http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_VFlashView -u:"&$username&" -p:"&$password&" -r:https://"&$ipaddress&"/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic", -1, True) Send("{Enter}") EndFunc Link to comment Share on other sites More sharing options...
byoda Posted June 24, 2010 Author Share Posted June 24, 2010 I understand, but how would i integrate these functions into my allready existing functions?Here is a function that I am calling and want to show status. Thank you.Func Winrm()CmdLog("winrm e http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_VFlashView -u:"&$username&" -p:"&$password&" -r:https://"&$ipaddress&"/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic", -1, True)Send("{Enter}")EndFuncOr would I have to create individual functions for my status and call them before the actual command is ran? Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 24, 2010 Moderators Share Posted June 24, 2010 (edited) byoda, how would i integrate these functions into my allready existing functions?Perhaps like this: Func Winrm() GUICtrlSetData($hLabel, "Winrm function is currently running...") CmdLog("winrm e http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_VFlashView -u:"&$username&" -p:"&$password&" -r:https://"&$ipaddress&"/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic", -1, True) Send("{Enter}") GUICtrlSetData($hLabel, "") EndFunc M23 Edit: Messed up the tags Edited June 24, 2010 by Melba23 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 Link to comment Share on other sites More sharing options...
byoda Posted June 24, 2010 Author Share Posted June 24, 2010 byoda, Perhaps like this: Func Winrm() GUICtrlSetData($hLabel, "Winrm function is currently running...") CmdLog("winrm e http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_VFlashView -u:"&$username&" -p:"&$password&" -r:https://"&$ipaddress&"/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic", -1, True) Send("{Enter}") GUICtrlSetData($hLabel, "") EndFunc M23 Edit: Messed up the tags Got it working, thank you very much.... One last thing if you have time. If i wanted to also include the status by number, eg "3 of 12 completed", but doing this dynamically, since my functions would never be called in the same order, how would i do so? Example ******************* 4 of 5 completed read write read log ****************** ****************** 1 of 3 completed write log read ****************** Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 24, 2010 Moderators Share Posted June 24, 2010 byoda,Set a count to zero as you begin - then augment it by one as you enter each function like this: Global $iCount = 0 ; ... Func Winrm() ; Increase the count $iCount += 1You presumably can determine how many functions will run each time - how else would you know whether to run them. Then concatenate the values and put the resulting string in a label with GUICtrlSetData. M23P.S. When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. 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 Link to comment Share on other sites More sharing options...
byoda Posted June 24, 2010 Author Share Posted June 24, 2010 Global $iCount=0 $hGUI=GUICreate("Test", 300, 75) $progress=GUICtrlCreateLabel("", 30, 50, 480, 40) GUISetState() Winrm() Winrm() Func Winrm() $iCount+=1 GUICtrlSetData($progress, $iCount) EndFunc A Couple of things 1. When I try the following, only the number shows up. $progress=GUICtrlCreateLabel("""out of 12", 30, 50, 480, 40) 2. When the first Winrm() is ran, nothing shows up. What am i missing? Thank you. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 24, 2010 Moderators Share Posted June 24, 2010 byoda, When I try the following, only the number shows upBecause you are only asking for the number to be displayed. You could perhaps use multiple labels and concatenation (joining strings together) like this: expandcollapse popup#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hLabel_1 = GUICtrlCreateLabel("", 10, 10, 480, 20) $hLabel_2 = GUICtrlCreateLabel("", 10, 30, 480, 270) $hButton_Read = GUICtrlCreateButton("Read", 10, 300, 80, 30) $hButton_Write = GUICtrlCreateButton("Write", 10, 340, 80, 30) $hButton_Log = GUICtrlCreateButton("Log", 10, 380, 80, 30) GUISetState() Global $iCounter = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton_Read _Read() Case $hButton_Write _Write() Case $hButton_Log _Log() EndSwitch WEnd Func _Read() $iCounter += 1 GUICtrlSetData($hLabel_1, $iCounter & " of 3") $sText = GUICtrlRead($hLabel_2) GUICtrlSetData($hLabel_2, $sText & @CRLF & "Read function is currently running...") Sleep(2000) ; Here is your function code GUICtrlSetData($hLabel_2, $sText & @CRLF & "Read function has ended") EndFunc Func _Write() $iCounter += 1 GUICtrlSetData($hLabel_1, $iCounter & " of 3") $sText = GUICtrlRead($hLabel_2) GUICtrlSetData($hLabel_2, $sText & @CRLF & "Write function is currently running...") Sleep(2000) ; Here is your function code GUICtrlSetData($hLabel_2, $sText & @CRLF & "Write function has ended") EndFunc Func _Log() $iCounter += 1 GUICtrlSetData($hLabel_1, $iCounter & " of 3") $sText = GUICtrlRead($hLabel_2) GUICtrlSetData($hLabel_2, $sText & @CRLF & "Log function is currently running...") Sleep(2000) ; Here is your function code GUICtrlSetData($hLabel_2, $sText & @CRLF & "Log function has ended") 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 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