Jump to content
Sign in to follow this  

Progress History UDF

Recommended Posts


Happy NEW Year, finaly after a lot of faitures i finished my first UDF,

it holds two functions: _ProgHisInit() and _ProgHisSet()

Here is my sample code, please try and make comments to it.

UDF, save as GuiProgHis.au3:

#region Header
    Title:   Progress History UDF Library for AutoIt3
    Filename:  GuiProgHis.au3
    Description: A collection of functions for creating and updating a Progress History.
    Author:   JRSmile
    Version:  T1.0
    Last Update: 1/1/06
    Requirements: AutoIt3 Beta ( or higher), Developed/Tested on Windows2000 Professional
    This is just a simple POC release, it is not very fast and hast a mad cpu performance as result.
    Update History:
    T1.0 1/1/06
    Initial Release - error handling is not present right now, documentation has just begun, only initial UDF standards met.
    \\\ Core Functions
    Creates a progress history out of progressbars
    Updates the progress history created with _ProgHisInit()
#region Core functions
; Function Name:    _ProgHisInit()
; Description:    Creates a progress history out of progressbars
; Parameter(s):  $x           - relative position in the GUI x-axis
;                  $y             - relative position in the GUI y-axis
;                  $width       - width of the history
;                  $hight       - hight of the history
;                  $bgcolor   - background color of the history (default: black)
;                  $color       - color of the history (default: green)
; Requirement(s):   $x,$y,$width,$hight
; Return Value(s):  On Success - Creates the Progress history at the desired coordinates.
;                  On Failure - NONE
; Author(s):        JRSmile
func _ProgHisInit($x,$y,$i_width,$i_hight,$b_bgcolor = 0x000000,$b_color = 0x00FF00)
    $s_list = ""
    for $i = 1 to $i_width step 2
        $s_list &= "|" & GuiCtrlCreateProgress($x + $i, $y, 3, $i_hight,$PBS_VERTICAL + $PBS_SMOOTH)
    $ai_List = StringSplit($s_list,"|")
    return $ai_List
EndFunc  ;==>_ProgHisInit

; Function Name:    _ProgHisSet()
; Description:    Updates the progress history created with _ProgHisInit()
; Parameter(s):  $val         - the new value to be added to the history
;                  $ai_List     - the progress history handler to be updated
; Requirement(s):   $val,$ai_List
; Return Value(s):  On Success - Displays the updated history
;                  On Failure - NONE
; Author(s):        JRSmile
func _ProgHisSet($i_val,$ai_List)
    Local $s_List,$ai_UpdatedList
    for $i = 2 to $ai_List[0]
        $s_List &= "|" & GUICtrlRead($ai_List[$i])
    $ai_UpdatedList = StringSplit($s_List,"|")
    For $i = 0 To (UBound($ai_UpdatedList) - 2)
        $ai_UpdatedList[$i] = $ai_UpdatedList[$i + 1]
    Local $i = (UBound($ai_UpdatedList) - 1)
    $ai_UpdatedList[$i] = $i_val
    for $i = 2 to $ai_List[0]
        GUICtrlSetTip($ai_List[$i],$ai_UpdatedList[$i] & "%")
EndFunc  ;==>_ProgHisSet

the example, save in the same folder:

#include <GuiConstants.au3>
#include <GuiProgHis.au3>
GuiCreate("Progress History Sample GUI", 400, 80)
; easy way to integrate it in a gui
$ai_List = _ProgHisInit(0,0,400,80,0x000000,0x00FF00) 

While 1
; just give it a variable and everything is done for you.

func close()

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*ยต&Asc(4)Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])))''Chr("a")&"HI"Next;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)

Share this post

Link to post
Share on other sites

Hey that's really neat for your first UDF JRSmile... no comments, I just ran the code, hadn't looked at it yet... but good job!

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.