Jump to content
Sign in to follow this  
eri

How to set progress...??

Recommended Posts

eri

$makecab = Run (@ComSpec & " /c makecab D:\image.ima D:\Image.cab") ; ,"",@SW_HIDE
ProgressOn("Makecab", "Makecab", "CAB")
    ProgressSet(" ???? ")
ProgressOff()

I want run makecab in hiden.. but show in progress, equal with percentage in cmd.exe

How to create ProgressSet script in my script..??

Please for all master Help me... :mellow:

Share this post


Link to post
Share on other sites
Melba23

eri,

Look at StdoutRead to see how to get the contents of the Cmd Prompt. Once you have extracted the percentage value from the returned text, you can use it to set your progress bar. :mellow:

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
eri

eri,

Look at StdoutRead to see how to get the contents of the Cmd Prompt. Once you have extracted the percentage value from the returned text, you can use it to set your progress bar. :(

M23

Hi M23,

I have search about StdoutRead and Found some script then I create script :

$Pid = Run('"' & @ComSpec & '" /c makecab D:\image.ima D:\image.cab' , '', @SW_HIDE, 2 + 4) ; 2+4 could You explain what means it`s
ProgressOn("Progress CAB","Creating CAB")
    While 1
        $line = StdoutRead($Pid)
        If @error Then ExitLoop
        $line1 = StringSplit($line, '%')
        $line2 = StringRight($line1[1], 2)
        If $line <> "" Then
            ProgressSet($line, $line2 & " percent" )
        EndIf
    WEnd
ProgressOff()

but not yet perfect and I do not know what to do anymore. Can you improve it for me.. :mellow:

and what`s means 2+4 in ..., @SW_HIDE, 2 + 4)

Thank`s M23

Edited by eri

Share this post


Link to post
Share on other sites
Melba23

eri,

Well done - you do not need help from us any more! :(

Can you improve it for me

Not a lot to do - but here is how I would have done it on my machine. I felt that the flushing time was so short there was little point in running the progress bar again (twice) so I arranged the code to prevent that:

#include <Constants.au3>

ProgressOn("Progress CAB","Creating CAB")

$iPID = Run('"' & @ComSpec & '" /c makecab D:\image.ima D:\image.cab', '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

    While 1
        
        $sData = StdoutRead($iPID)
        If @error Then ExitLoop
        If StringInStr($sData, "flushing") = 0 Then
            $aData = StringSplit($sData, '%')
            $iPercent = Int($aData[1])
            ProgressSet($sData + 1)
            ProgressSet($sData, $iPercent & " percent")
        Else
            ProgressSet(100 , "Flushing")
        EndIf

        Sleep(10)

    WEnd

ProgressOff()

Note the trick to get the progress bar to increase quickly - if you do not do that then it tends to lag badly (at least in Vista) and you will finish with the bar still at about 60%! :mellow:

what`s means 2+4 in ..., @SW_HIDE, 2 + 4)

These are the constants $STDERR_CHILD and $STDOUT_CHILD - you find them in Constants.au3. Using the actual values saves you having to add the include file as in the example above.

Top


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
eri

Running the progress bar(twice) so I arranged the code to prevent that:

That`s I mean my script not perfect.. And you give me the solution.. Thank M23 You are my teacher for me.. You give me any solution for my Ignorance in scripting.. :mellow:

Once again thank`s M23.. :(

Share this post


Link to post
Share on other sites
kasuya

Good day guys. I'm just learning autoit and i need your help in making a progress bar to ping a computer using stdreadout. The progress bar will continue to run until a certain site will reply when pinged. What i mean is that when you ping a website using command prompt, the script will read the phrase "Reply from" and would automatically stop and will post a message confirming that the site is alive. I have a vb script that does this but it doesn't have a GUI or progress bar. here is my vb scipt code:

While Not Connected

strTarget = "www.google.com"

Set objShell = CreateObject("WScript.Shell")

Set objExec = objShell.Exec("ping -n 2 -w 1000 " & strTarget)

strPingResults = LCase(objExec.StdOut.ReadAll)

If InStr(strPingResults, "reply from") Then

Connected=True

End If

Wend

Thanks.

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  

×