Jump to content



Photo

Progress Bar Udf


  • Please log in to reply
11 replies to this topic

#1 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 03 May 2006 - 09:28 PM

Do you like the simplicity of ProgressOn, ProgressSet and ProgressOff but want them in a gui? Now you can.

I made this UDF to replicate the pop up progress bar. ProgressSet acts mostly the same. ProgressOn is different.
AutoIt         
#include <GUIConstants.au3> #include <file.au3> GUICreate("Progress Demo", 600, 500) GUISetState() Dim $progress, $main, $sub $prog = _ProgressOn($progress, $main, $sub, "This is the main text", "This is the sub-text", 150, 10) For $i = 1 To 100  _ProgressSet($prog, $i, "This is the sub-text " & $i & "%")  Sleep(100) Next _ProgressOff($prog) $prog = _ProgressOn($progress, $main, $sub, "This will change", "This is a moved example", 320, 300, 1) Sleep(1000) For $i = 1 To 100  _ProgressSet($prog, $i, "", "This time the main text changes") ;use "" for the default string  Sleep(100) Next _ProgressOff($prog) While 1  Switch GUIGetMsg()   Case $GUI_EVENT_CLOSE    Exit  EndSwitch WEnd ;=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= ;UDF Below ;=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= ;=============================================================================== ; ; Function Name:   _ProgressOn ; Description::    Creates a 'ProgressOn like' progress bar in a gui ; Syntax:     Dim $progress, $main, $sub ;make sure you dim the first three variables. they are the controlId's ;       _ProgressOn($progress, $main, $sub, "This is the main text", "This is the sub-text", 150, 10) ; Parameter(s):    $s_mainlabel($main-text var), $s_sublabel($sub-text var), ;       $s_control($progress var), $s_main(Main text), $s_sub(Sub Text), $x(Position), $y(Position), $fSmooth(1 for smooth, 0 for not smooth) ; Requirement(s):  AutoIt, #include <file.au3> ; Return Value(s): Success - Returns array ;       $array[0] - $progress id ;       $array[1] - Main Label ;       $array[2] - Sub label ;       $array[3] - x pos ;       $array[4] - y pos ;       Failure - 0 and sets @error to 1 ; Author(s):       RazerM ; ;=============================================================================== ; Func _ProgressOn(ByRef $s_mainlabel, ByRef $s_sublabel, ByRef $s_control, $s_main, $s_sub, $x, $y, $fSmooth = 0)  $s_mainlabel = GUICtrlCreateLabel($s_main, $x, $y, StringLen($s_main) * 10)  If $s_mainlabel = 0 Then   SetError(1)   Return 0  EndIf  GUICtrlSetFont($s_mainlabel, 14)  If StringInStr(@OSTYPE, "WIN32_NT") And $fSmooth = 1 Then   $prev = DllCall("uxtheme.dll", "int", "GetThemeAppProperties");, "int", 0)   DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)  EndIf  $s_control = GUICtrlCreateProgress($x, $y + 30, 260, 20, $PBS_SMOOTH)  If StringInStr(@OSTYPE, "WIN32_NT") And $fSmooth = 1 Then   DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $prev[0])  EndIf  If $s_control = 0 Then   SetError(1)   Return 0  EndIf  $s_sublabel = GUICtrlCreateLabel($s_sub, $x, $y + 55)  If $s_sublabel = 0 Then   SetError(1)   Return 0  EndIf  Dim $a_info[5]  $a_info[0] = $s_control  $a_info[1] = $s_mainlabel  $a_info[2] = $s_sublabel  $a_info[3] = $x  $a_info[4] = $y  Return $a_info EndFunc   ;==>_ProgressOn ;=============================================================================== ; ; Function Name:   _ProgressSet ; Description::    Sets a progressbar created with _ProgressOn ; Parameter(s):    $a_info(Progress Id returned by _ProgressOn), $i_per(Percent), $s_sub(Sub text)[optional], $s_main(main text)[optional] ; Requirement(s):  AutoIt, #include <file.au3> ; Return Value(s): Success - 1, Failure - 0 and sets @error to 1 ; Author(s):       RazerM ; ;=============================================================================== ; Func _ProgressSet($a_info, $i_per, $s_sub = "", $s_main = "")  If $s_main = "" Then $s_main = GUICtrlRead($a_info[1])  If $s_sub = "" Then $s_sub = GUICtrlRead($a_info[2])  $set1 = GUICtrlSetData($a_info[0], $i_per)  $set2 = GUICtrlSetData($a_info[1], $s_main)  $set3 = GUICtrlSetData($a_info[2], $s_sub)  GUICtrlSetPos($a_info[2], $a_info[3], $a_info[4] + 55, StringLen($s_sub) * 6)  GUICtrlSetPos($a_info[1], $a_info[3], $a_info[4], StringLen($s_main) * 10)  If ($set1 = 0) Or ($set2 = 0) Or ($set3 = 0) Then   SetError(1)   Return 0  EndIf  If ($set1 = -1) Or ($set2 = -1) Or ($set3 = -1) Then   SetError(1)   Return 0  EndIf  Return 1 EndFunc   ;==>_ProgressSet ;=============================================================================== ; ; Function Name:   _ProgressOff() ; Description::    Deletes a progress bar created with _ProgressOn() ; Parameter(s):    $a_info(Progress Id returned by _ProgressOn) ; Requirement(s):  AutoIt, #include <file.au3> ; Return Value(s): Success - 1, Failure - 0 and sets @error to 1 ; Author(s):       RazerM ; ;=============================================================================== ; Func _ProgressOff($a_info)  $del1 = GUICtrlDelete($a_info[1])  $del2 = GUICtrlDelete($a_info[2])  $del3 = GUICtrlDelete($a_info[0])  If ($del1 = 0) Or ($del2 = 0) Or ($del3 = 0) Then   SetError(1)   Return 0  EndIf EndFunc   ;==>_ProgressOff


The UDF is on it's own here:Attached File  Progress.au3   3.94K   1501 downloads
Previous Downloads: 191

Update: Added $fSmooth into _ProgressOn, set to 1 for a smooth prgress bar

Edited by RazerM, 04 October 2006 - 04:55 PM.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.







#2 MadBoy

MadBoy

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 829 posts

Posted 04 May 2006 - 11:09 AM

Great! Tnx :think:

#3 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 04 May 2006 - 02:52 PM

no problem
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

#4 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 04 May 2006 - 03:20 PM

I have updated the udf to use an array
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

#5 enigmafyv

enigmafyv

    Seeker

  • Active Members
  • 14 posts

Posted 04 May 2006 - 03:44 PM

I'm still a noob, so please excuse my ignorance.

Where might I be able to find the #includes?

What's the easiest way to get them?

Is there a part of the forum for noobs?

Thx

#6 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,078 posts

Posted 04 May 2006 - 03:46 PM

I'm still a noob, so please excuse my ignorance.

Where might I be able to find the #includes?

What's the easiest way to get them?

Is there a part of the forum for noobs?

Thx



"Welcome to Autoit 1-2-3" is your friend

click below ( in the signature area)

8)

Posted Image

Clic The Pic!!!


#7 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 04 October 2006 - 04:57 PM

I've updated the UDF with a "smooth" paramater that sets the Progress Bar with a $PBS_SMOOTH style(Works on WinXP too)
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

#8 deltron

deltron

    Seeker

  • Active Members
  • 30 posts

Posted 13 October 2006 - 03:59 PM

is there any way to have a break in the progress? I want to be able to have an OK button to stop a countdown. Also if possible, and is there any way to make the size of the _ProgressSet text box any bigger? My text is being cut off :lmao:

#9 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 13 October 2006 - 04:11 PM

It should be the correct size automatically, post the script you are having trouble with please.
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

#10 Asaman83687

Asaman83687

    Seeker

  • Active Members
  • 7 posts

Posted 23 April 2008 - 07:41 AM

I'm still a noob, so please excuse my ignorance.

Where might I be able to find the #includes?

What's the easiest way to get them?

Is there a part of the forum for noobs?

Thx


You may read it's location at autoit.chm file, just look for it.....Hahhaha

#11 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 23 April 2008 - 07:54 AM

You may read it's location at autoit.chm file, just look for it.....Hahhaha

You realizing that you are answering to a post that is actualy 2 years old? :D

P.S
Nice UDF @RazerM :D
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#12 pintas

pintas

    Prodigy

  • Active Members
  • PipPipPip
  • 160 posts

Posted 22 May 2010 - 10:40 PM

Can i implement it on an FTP transfer? _FTP_ProgressUpload is very badly explained on the help file. :idea:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users