Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
;#################################################################### ;# Initialize the Progress Meter Dialog Box ;#################################################################### ;#################################################################### ;# Update the progress meter dialog box ;#################################################################### #DefineFunction UPDATETHERMS(FirstRun) Ptr_G_ALLFILES =PtrGlobal( ALLFILES) Ptr_G_ALLDIRS =PtrGlobal( ALLDIRS) Ptr_G_ALLRECS =PtrGlobal( ALLRECS) Ptr_G_DONEFILES =PtrGlobal( DONEFILES) Ptr_G_DONEDIRS =PtrGlobal( DONEDIRS) Ptr_G_DONERECS =PtrGlobal( DONERECS) Ptr_G_Thermid =PtrGlobal( THERMID) ;-Bring values into temps because we can't multiply using the *Ptr syntax ALLFILES=*Ptr_G_ALLFILES ALLDIRS=*Ptr_G_ALLDIRS ALLRECS=*Ptr_G_ALLRECS DONEFILES=*Ptr_G_DONEFILES DONEDIRS=*Ptr_G_DONEDIRS DONERECS=*Ptr_G_DONERECS Thermid=*Ptr_G_Thermid ;;;;;;;; Assorted Colors ;;;;;;;;; LTGRAY="192,192,192" GRAY="128,128,128" GREEN="0,255,0" BLACK="0,0,0" WHITE="255,255,255" If FirstRun Then ; Initialize the Progress Meter Dialog Box ; 12 - Windows Closing Handling ; 5 - Allow Windows to be shutdown while running without prompting ; 0,0,0 - N/A in this situation IntControl(12,5,0,0,0) ;Start a dialog box BoxesUp("250,100,750,300",@NORMAL) BoxTitle("Please wait. Deleting Files") rectTherm1="0,0,1000,1000" ;Draw thermoneter outline BoxNew(Thermid,rectTherm1,2) BoxUpdates(Thermid,0) BoxColor(Thermid,LTGRAY,0) BoxDrawRect(Thermid,"",2) ; Draw updating thermometer here ; there are 3 virtual pixels per percent ; we have to draw 3 boxes and some text... BoxDataTag(Thermid,"FRED") End If ; - INI Entry Meter rectTherm1Line1="100,250,900,250" rectTherm1Line2="900,250,900,450" rectTherm1Line3="900,450,100,450" rectTherm1Line4="100,450,100,250" ; - Directories Meter rectTherm2Line1="100,500,900,500" rectTherm2Line2="900,500,900,700" rectTherm2Line3="900,700,100,700" rectTherm2Line4="100,700,100,500" ; - Files Meter rectTherm3Line1="100,750,900,750" rectTherm3Line2="900,750,900,950" rectTherm3Line3="900,950,100,950" rectTherm3Line4="100,950,100,750" ThermPenWidth=20 rectTherm1Text1="100,50,1000,199" rectTherm1Text2="20,250,95,450" rectTherm1Text3="20,500,95,700" rectTherm1Text4="20,750,95,950" rectTherm1Percent="450,254,550,446" rectTherm2Percent="450,504,550,696" rectTherm3Percent="450,754,550,746" ; Update the Progress Meter.. BoxDataClear(Thermid,"FRED") BoxUpdates(Thermid,0) ; ; rectTherm1Line1="100,250,900,250" ; rectTherm1Line2="900,250,900,450" ; rectTherm1Line3="900,450,100,450" ; rectTherm1Line4="100,450,100,250" ; - Progress Meter for INI File entries xxx= 100+((800*DONERECS)/ALLRECS) per1=(100.0*DONERECS)/ALLRECS per1=Int(per1) ;Sanity Check - Keep from displaying 100% until we are done. If per1=="100" && DONERECS < ALLRECS Then per1="99.5" BoxColor(Thermid,GREEN,0) BoxDrawRect(Thermid,"101,254,%xxx%,446",2) BoxColor(Thermid,GRAY,0) BoxDrawRect(Thermid,"%xxx%,254,899,446",2) BoxPen(Thermid,BLACK,ThermPenWidth) ; ; - Directories Meter ; rectTherm2Line1="100,500,900,500" ; rectTherm2Line2="900,500,900,700" ; rectTherm2Line3="900,700,100,700" ; rectTherm2Line4="100,700,100,500" ; - Progress Meter for Directories yyy = 100+(800*DONEDIRS)/ALLDIRS per2= (100.0*DONEDIRS)/ALLDIRS per2=Int(per2) ;Sanity Check - Keep from displaying 100% until we are done. If per2=="100" && DONEDIRS < ALLDIRS Then per2="99.5" BoxColor(Thermid,GREEN,0) BoxDrawRect(Thermid,"101,504,%yyy%,696",2) BoxColor(Thermid,GRAY,0) BoxDrawRect(Thermid,"%yyy%,504,899,696",2) BoxPen(Thermid,BLACK,ThermPenWidth) ; ; - Files Meter ; rectTherm3Line1="100,750,900,750" ; rectTherm3Line2="900,750,900,950" ; rectTherm3Line3="900,950,100,950" ; rectTherm3Line4="100,950,100,750" ; - Progress Meter for Files zzz = 100+((800*DONEFILES)/ALLFILES) per3=(100.0*DONEFILES)/ALLFILES per3=Int(per3) ;Sanity Check - Keep from displaying 100% until we are done. If per3=="100" && DONEFILES < ALLFILES Then per3="99.5" BoxColor(Thermid,GREEN,0) BoxDrawRect(Thermid,"101,754,%zzz%,946",2) BoxColor(Thermid,GRAY,0) BoxDrawRect(Thermid,"%zzz%,754,899,946",2) BoxPen(Thermid,BLACK,ThermPenWidth) BoxDrawLine(Thermid,rectTherm1Line1) BoxDrawLine(Thermid,rectTherm1Line2) BoxDrawLine(Thermid,rectTherm1Line3) BoxDrawLine(Thermid,rectTherm1Line4) BoxDrawLine(Thermid,rectTherm2Line1) BoxDrawLine(Thermid,rectTherm2Line2) BoxDrawLine(Thermid,rectTherm2Line3) BoxDrawLine(Thermid,rectTherm2Line4) BoxDrawLine(Thermid,rectTherm3Line1) BoxDrawLine(Thermid,rectTherm3Line2) BoxDrawLine(Thermid,rectTherm3Line3) BoxDrawLine(Thermid,rectTherm3Line4) ; Write the Percentage If per1<50 Then BoxTextColor(Thermid,WHITE) Else BoxTextColor(Thermid,BLACK) End If BoxDrawText(Thermid,rectTherm1Percent,"%per1%%%",0,0) If per2<50 Then BoxTextColor(Thermid,WHITE) Else BoxTextColor(Thermid,BLACK) End If BoxDrawText(Thermid,rectTherm2Percent,"%per2%%%",0,0) If per3<50 Then BoxTextColor(Thermid,WHITE) Else BoxTextColor(Thermid,BLACK) End If BoxDrawText(Thermid,rectTherm3Percent,"%per3%%%",0,0) BoxTextColor(Thermid,BLACK) BoxColor(Thermid,LTGRAY,0) BoxDrawText(Thermid,rectTherm1Text1,"Completed: %LC%",1,0) BoxDrawText(Thermid,rectTherm1Text2,"INI",1,0) BoxDrawText(Thermid,rectTherm1Text3,"Dirs",1,0) BoxDrawText(Thermid,rectTherm1Text4,"Files",1,0) BoxUpdates(Thermid,2) Return #EndFunction #DefineFunction SimulatedPurge() Ptr_G_ALLFILES =PtrGlobal( ALLFILES) Ptr_G_ALLDIRS =PtrGlobal( ALLDIRS) Ptr_G_ALLRECS =PtrGlobal( ALLRECS) Ptr_G_DONEFILES =PtrGlobal( DONEFILES) Ptr_G_DONEDIRS =PtrGlobal( DONEDIRS) Ptr_G_DONERECS =PtrGlobal( DONERECS) Ptr_G_Thermid =PtrGlobal( THERMID) For y=1 To 2 For z=1 To 250 *Ptr_G_DONEFILES=*Ptr_G_DONEFILES+1 UpdateTherms(@FALSE) Next z *Ptr_G_DONEDIRS=*Ptr_G_DONEDIRS+1 Next y #EndFunction ;############################################################ ;# MAIN ;############################################################ PtrGlobalDefine( ALLFILES) PtrGlobalDefine( ALLDIRS) PtrGlobalDefine( ALLRECS) PtrGlobalDefine( DONEFILES) PtrGlobalDefine( DONEDIRS) PtrGlobalDefine( DONERECS) PtrGlobalDefine( THERMID) Thermid=3 UpdateTherms(@TRUE) ALLRECS=10 ALLDIRS=2*ALLRECS ALLFILES=250*ALLDIRS DONEFILES=0 DONEDIRS=0 DONERECS=0 For x=1 To ALLRECS SimulatedPurge() DONERECS=DONERECS+1 UpdateTherms(@FALSE) Next x UpdateTherms(@FALSE) TimeDelay(3)
Article ID: W16983
File Created: 2007:07:03:14:27:28
Last Updated: 2007:07:03:14:27:28