Ahmed97 Posted June 7, 2011 Share Posted June 7, 2011 Hi, i have a problem here with Progress... i wanna make a script showing the process list then progress loading when i press the "show process list" button i tryed this code but failed :S expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Task Manger", 218, 330, -1, -1) $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem3 = GUICtrlCreateMenu("&Help") $MenuItem4 = GUICtrlCreateMenuItem("About", $MenuItem3) $List = GUICtrlCreateList("", 24, 8, 169, 182) GUICtrlSetFont(-1, 7, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetBkColor(-1, 0xFFFFFF) $ShowProcess = GUICtrlCreateButton("Show Process List", 46, 211, 115, 33, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Exit = GUICtrlCreateButton("Exit", 65, 280, 75, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $EndPro = GUICtrlCreateButton("End Process", 58, 249, 91, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Progress1 = GUICtrlCreateProgress(27, 192, 150, 17, $WS_HSCROLL) GUICtrlSetData(-1, 0) GUICtrlSetColor(-1, 0x000000) $Label1 = GUICtrlCreateLabel("0", 184, 192, 10, 17) GUISetState(@SW_SHOW) $RP = GUICtrlRead($Progress1) $sleep = Sleep(4000) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $Exit Exit Case $nMsg = $ShowProcess ;;;;; Hereeeee ;;;;;;;;;; $SetData = GUICtrlSetData() ;;;;;;;;;;;;;; For $P = 1 To 100 Step 2 ;;;;;;;;;;;;;; Sleep(1) ;;;;;;;;;;;;;;;;;;;; ProgressSet($P, $P, "%") ;;;;;;;;;;;;;;;; Next ;;;;;;;;;;;;;;;;;;;;;;;;; Sleep(2000) ;;;;;;;;;;;;; $Processes = ProcessList() ;;;;;;;;;;; For $i = 1 To $Processes[0][0] ;;;;;;;;;;;;;; GUICtrlSetData($List, $Processes[$i][0]) ;;;;;;;;;;;;;; Next ;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $nMsg = $EndPro $proclose = ProcessClose(GUICtrlRead($List)) If $proclose = 1 Then GUICtrlDelete($List) Sleep(20) GUICtrlCreateList("", 24, 8, 169, 182) Sleep(400) $Processes2 = ProcessList() For $i = 1 To $Processes2[0][0] GUICtrlSetData($List, $Processes2[$i][0]) Next ElseIf $proclose <> 1 Then MsgBox(16, "Error", "Access Denied") EndIf EndSelect WEnd Link to comment Share on other sites More sharing options...
JoHanatCent Posted June 8, 2011 Share Posted June 8, 2011 Hi, i have a problem here with Progress... i wanna make a script showing the process list then progress loading when i press the "show process list" button i tryed this code but failed :S Try this. Changes marked with ;<<< ======= expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Task Manger", 218, 330, -1, -1) $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem3 = GUICtrlCreateMenu("&Help") $MenuItem4 = GUICtrlCreateMenuItem("About", $MenuItem3) $List = GUICtrlCreateList("", 24, 8, 169, 182) GUICtrlSetFont(-1, 7, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetBkColor(-1, 0xFFFFFF) $ShowProcess = GUICtrlCreateButton("Show Process List", 46, 211, 115, 33, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Exit = GUICtrlCreateButton("Exit", 65, 280, 75, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $EndPro = GUICtrlCreateButton("End Process", 58, 249, 91, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Progress1 = GUICtrlCreateProgress(27, 192, 150, 17, $WS_HSCROLL) GUICtrlSetData(-1, 0) GUICtrlSetColor(-1, 0x000000) $Label1 = GUICtrlCreateLabel("0", 184, 192, 10, 17) GUISetState(@SW_SHOW) $RP = GUICtrlRead($Progress1) $sleep = Sleep(4000) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $Exit Exit Case $nMsg = $ShowProcess $SetData = GUICtrlSetData($ShowProcess, '----Buzy!----') ;<<< ====== ProgressOn("Progress Meter", "Increments every second", "0 percent");<<< ====== For $P = 1 To 100 Step 2 Sleep(1) ProgressSet($P, $P, "%") Next Sleep(2000) ProgressSet(100, "Done", "Complete");<<< ====== Sleep(500);<<< ====== ProgressOff();<<< ====== $Processes = ProcessList() For $i = 1 To $Processes[0][0] GUICtrlSetData($List, $Processes[$i][0]) Next $SetData = GUICtrlSetData($ShowProcess, "Show Process List");<<< ====== Case $nMsg = $EndPro $proclose = ProcessClose(GUICtrlRead($List)) If $proclose = 1 Then GUICtrlDelete($List) Sleep(20) GUICtrlCreateList("", 24, 8, 169, 182) Sleep(400) $Processes2 = ProcessList() For $i = 1 To $Processes2[0][0] GUICtrlSetData($List, $Processes2[$i][0]) Next ElseIf $proclose <> 1 Then MsgBox(16, "Error", "Access Denied") EndIf EndSelect WEnd Link to comment Share on other sites More sharing options...
Ahmed97 Posted June 8, 2011 Author Share Posted June 8, 2011 i dont understand the code, and it's opening new progress in independent gui. i wanna make "progress1" which under the process list loading, not open progress in new gui Link to comment Share on other sites More sharing options...
Andreik Posted June 8, 2011 Share Posted June 8, 2011 This is what you need? expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Task Manger", 218, 330, -1, -1) $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem3 = GUICtrlCreateMenu("&Help") $MenuItem4 = GUICtrlCreateMenuItem("About", $MenuItem3) $List = GUICtrlCreateList("", 24, 8, 169, 182) GUICtrlSetFont(-1, 7, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetBkColor(-1, 0xFFFFFF) $ShowProcess = GUICtrlCreateButton("Show Process List", 46, 211, 115, 33, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Exit = GUICtrlCreateButton("Exit", 65, 280, 75, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $EndPro = GUICtrlCreateButton("End Process", 58, 249, 91, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Progress1 = GUICtrlCreateProgress(27, 192, 150, 17, $WS_HSCROLL) GUICtrlSetData(-1, 0) GUICtrlSetColor(-1, 0x000000) $Label1 = GUICtrlCreateLabel("0", 184, 192, 10, 17) GUISetState(@SW_SHOW) $RP = GUICtrlRead($Progress1) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $Exit Exit Case $nMsg = $ShowProcess ;;;;; Hereeeee ;;;;;;;;;; $Processes = ProcessList() For $i = 1 To $Processes[0][0] GUICtrlSetData($List,$Processes[$i][0],1) GUICtrlSetData($Label1,$i) GUICtrlSetData($Progress1,$i*100/$Processes[0][0]) Sleep(100) Next Case $nMsg = $EndPro $proclose = ProcessClose(GUICtrlRead($List)) If $proclose = 1 Then GUICtrlDelete($List) Sleep(20) GUICtrlCreateList("", 24, 8, 169, 182) Sleep(400) $Processes2 = ProcessList() For $i = 1 To $Processes2[0][0] GUICtrlSetData($List, $Processes2[$i][0]) Next ElseIf $proclose <> 1 Then MsgBox(16, "Error", "Access Denied") EndIf EndSelect WEnd When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Ahmed97 Posted June 8, 2011 Author Share Posted June 8, 2011 yes, its awesome.. but the label up to 36 and stop i want the loading max is 100. or the No.36 is processes number ? if yes then i will make new label to read process list and show the processes numbers, but this label i want it up to 100 the max of loading. thx and sorry for bad english ^^ Link to comment Share on other sites More sharing options...
Andreik Posted June 8, 2011 Share Posted June 8, 2011 I assumed that label was created to display the number of processes, so yes, what you see there is the number of processes but you need to set for there label other size to can see entire data, it's a little too small. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Ahmed97 Posted June 8, 2011 Author Share Posted June 8, 2011 (edited) Here's the new label expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Task Manger", 218, 330, -1, -1) $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem3 = GUICtrlCreateMenu("&Help") $MenuItem4 = GUICtrlCreateMenuItem("About", $MenuItem3) $List = GUICtrlCreateList("", 24, 8, 169, 182) GUICtrlSetFont(-1, 7, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetBkColor(-1, 0xFFFFFF) $ShowProcess = GUICtrlCreateButton("Show Process List", 46, 211, 115, 33, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Exit = GUICtrlCreateButton("Exit", 65, 280, 75, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $EndPro = GUICtrlCreateButton("End Process", 58, 249, 91, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Progress1 = GUICtrlCreateProgress(27, 192, 150, 17, $WS_HSCROLL) GUICtrlSetData(-1, 0) GUICtrlSetColor(-1, 0x000000) $Label1 = GUICtrlCreateLabel("0", 180, 192, 15, 17) $Label2 = GUICtrlCreateLabel("0", 2, 64, 10, 17) ;;; Here ;;; GUICtrlSetTip(-1, "Number of processes") GUISetState(@SW_SHOW) $RP = GUICtrlRead($Progress1) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $Exit Exit Case $nMsg = $ShowProcess ;;;;; Hereeeee ;;;;;;;;;; $Processes = ProcessList() For $i = 1 To $Processes[0][0] GUICtrlSetData($List,$Processes[$i][0],1) GUICtrlSetData($Label2,$i) ;;; i changed it :) ;;; GUICtrlSetData($Progress1,$i*100/$Processes[0][0]) Sleep(100) Next Case $nMsg = $EndPro $proclose = ProcessClose(GUICtrlRead($List)) If $proclose = 1 Then GUICtrlDelete($List) Sleep(20) GUICtrlCreateList("", 24, 8, 169, 182) Sleep(400) $Processes2 = ProcessList() For $i = 1 To $Processes2[0][0] GUICtrlSetData($List, $Processes2[$i][0]) Next ElseIf $proclose <> 1 Then MsgBox(16, "Error", "Access Denied") EndIf EndSelect WEnd Edited June 8, 2011 by TheMaster Link to comment Share on other sites More sharing options...
JoHanatCent Posted June 8, 2011 Share Posted June 8, 2011 Here's the new label So Label1 wil show persentage progress And Label2 the process number: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Task Manger", 218, 330, -1, -1) $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem3 = GUICtrlCreateMenu("&Help") $MenuItem4 = GUICtrlCreateMenuItem("About", $MenuItem3) $List = GUICtrlCreateList("", 24, 8, 169, 182) GUICtrlSetFont(-1, 7, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetBkColor(-1, 0xFFFFFF) $ShowProcess = GUICtrlCreateButton("Show Process List", 46, 211, 115, 33, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Exit = GUICtrlCreateButton("Exit", 65, 280, 75, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $EndPro = GUICtrlCreateButton("End Process", 58, 249, 91, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Progress1 = GUICtrlCreateProgress(27, 192, 150, 17, $PBS_SMOOTH, $WS_EX_TRANSPARENT) GUICtrlSetData(-1, 0) GUICtrlSetColor(-1, 0x000000) $Label1 = GUICtrlCreateLabel("0", 184, 192, 25, 17) $Label2 = GUICtrlCreateLabel("0", 2, 64, 15, 17) GUISetState(@SW_SHOW) $RP = GUICtrlRead($Progress1) $sleep = Sleep(4000) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $Exit Exit Case $nMsg = $ShowProcess $SetData = GUICtrlSetData($ShowProcess, '----Buzy!----') $Processes = ProcessList() For $i = 1 To $Processes[0][0] GUICtrlSetData($List, $Processes[$i][0]) GUICtrlSetData($Progress1, $i / $Processes[0][0] * 100) Sleep(25) GUICtrlSetData($Label1, Round($i / $Processes[0][0] * 100, 0)) GUICtrlSetData($Label2, $i) Next $SetData = GUICtrlSetData($ShowProcess, "Show Process List") GUICtrlSetData($Progress1, 0) GUICtrlSetData($Label1, "100%") Case $nMsg = $EndPro $proclose = ProcessClose(GUICtrlRead($List)) If $proclose = 1 Then GUICtrlDelete($List) Sleep(20) GUICtrlCreateList("", 24, 8, 169, 182) Sleep(400) $Processes2 = ProcessList() For $i = 1 To $Processes2[0][0] GUICtrlSetData($List, $Processes2[$i][0]) Next ElseIf $proclose <> 1 Then MsgBox(16, "Error", "Access Denied") EndIf EndSelect WEnd Link to comment Share on other sites More sharing options...
Ahmed97 Posted June 8, 2011 Author Share Posted June 8, 2011 (edited) thnxx bro, may anyone explain the code to me please ? >> explain code which befor " ; " Case $nMsg = $ShowProcess $SetData = GUICtrlSetData($ShowProcess, '----Buzy!----') $Processes = ProcessList() For $i = 1 To $Processes[0][0] GUICtrlSetData($List, $Processes[$i][0]) GUICtrlSetData($Progress1, $i / $Processes[0][0] * 100) ;;;;;; Sleep(25) GUICtrlSetData($Label1, Round($i / $Processes[0][0] * 100, 0)) ;;;;;; GUICtrlSetData($Label2, $i) ;;;;; Next $SetData = GUICtrlSetData($ShowProcess, "Show Process List") GUICtrlSetData($Progress1, 0) GUICtrlSetData($Label1, "100%") thnx.. Edited June 8, 2011 by TheMaster Link to comment Share on other sites More sharing options...
JoHanatCent Posted June 8, 2011 Share Posted June 8, 2011 thnxx bro, may anyone explain the code to me please ? >> explain code which befor " ; " thnx.. $SetData = GUICtrlSetData($ShowProcess, '----Buzy!----') $Processes = ProcessList() For $i = 1 To $Processes[0][0] GUICtrlSetData($List, $Processes[$i][0]) GUICtrlSetData($Progress1, $i / $Processes[0][0] * 100) ;Work out the process _ ;number over total process transactions times by hundered to get you a persentage Sleep(25) GUICtrlSetData($Label1, Round($i / $Processes[0][0] * 100, 0)) ;The same but rounding it to zero decimal points GUICtrlSetData($Label2, $i) ;Set the process number in $Label2 Next $SetData = GUICtrlSetData($ShowProcess, "Show Process List") GUICtrlSetData($Progress1, 0) GUICtrlSetData($Label1, "100%") Link to comment Share on other sites More sharing options...
Ahmed97 Posted June 8, 2011 Author Share Posted June 8, 2011 Thanks too much !! Link to comment Share on other sites More sharing options...
JoHanatCent Posted June 8, 2011 Share Posted June 8, 2011 Thanks too much !! Any time. If you get stuck again post it here for lots of help. 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