eri Posted March 5, 2010 Share Posted March 5, 2010 $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... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 5, 2010 Moderators Share Posted March 5, 2010 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 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...
eri Posted March 6, 2010 Author Share Posted March 6, 2010 (edited) 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.. and what`s means 2+4 in ..., @SW_HIDE, 2 + 4) Thank`s M23 Edited March 6, 2010 by eri Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 6, 2010 Moderators Share Posted March 6, 2010 eri, Well done - you do not need help from us any more! Can you improve it for meNot 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%! 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 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...
eri Posted March 6, 2010 Author Share Posted March 6, 2010 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.. Once again thank`s M23.. Link to comment Share on other sites More sharing options...
kasuya Posted July 30, 2011 Share Posted July 30, 2011 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. 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