Sign in to follow this  
Followers 0
byoda

GUI Dialog Status Update

9 posts in this topic

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.

Share this post


Link to post
Share on other sites



byoda,

Does this give you some ideas? :mellow:

#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._______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

 

Share this post


Link to post
Share on other sites

byoda,

Does this give you some ideas? :mellow:

#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

Share this post


Link to post
Share on other sites

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

Or would I have to create individual functions for my status and call them before the actual command is ran? Thanks

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

byoda,

how would i integrate these functions into my allready existing functions?

Perhaps like this: :mellow:

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 by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

byoda,

Perhaps like this: :mellow:

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

******************

Share this post


Link to post
Share on other sites

byoda,

Set a count to zero as you begin - then augment it by one as you enter each function like this: :mellow:

Global $iCount = 0

; ...

Func Winrm()
    ; Increase the count
    $iCount += 1

You presumably can determine how many functions will run each time - how else would you know whether to run them. :party:

Then concatenate the values and put the resulting string in a label with GUICtrlSetData. :P

M23

P.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. :party:


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

byoda,

When I try the following, only the number shows up

Because you are only asking for the number to be displayed. You could perhaps use multiple labels and concatenation (joining strings together) like this: :mellow:

#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._______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

 

Share this post


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
Sign in to follow this  
Followers 0