Jump to content

Progress_Bar_Ex ( UDF ?)


Uriziel01
 Share

Recommended Posts

Hi :) Progress Bar UDF have been writen to other bigger project, but I think it can be used as self standing UDF too.

1)Please download .exe compiled version, because my script is using .bmp files (3 files by 90bytes each), or when downloading an example dont forget to download imagesT.rar too(link below).

2)Please forgive me "simple" style of this pseudo UDF, as I have mentioned, it is only a part of other project (iRapid in this case).

3)Have a nice fun :P

Some ScreenShot: Posted Image

PreCompiled .EXE version: Progress_Bar_Ex_v0.2

ImagesT.rar file with images, it is only 400Byte file :D (when using .exe file you DONT need them, only when using .au3 version) : ImagesT.rar

p.s-You can really trust me, there are'nt any trojans etc. inside

p.s2-UDF is connected with example in one file

Abilities:

-Change colour of bar

-Change speed and jumps of bar ( in pixels)

-Use own texture file for bar

-Play a Beep sound on maximum value of the bar (changing frequency too)

-Start some function on maximum value of the bar

-Change size in all dimensions

-Simple add a label with % of bar value (can be ON or OFF)

-Using only 00 % of CPU :P

IMAGE FILES:

Posted Image

Posted Image

Posted Image

SourceCode:

#include <GUIConstants.au3>
if @compiled=1 then FileInstall("E:\Documents and Settings\PaBello\Pulpit\tile1.bmp",@TempDir&"\tile1.bmp",1)
if @compiled=1 then FileInstall("E:\Documents and Settings\PaBello\Pulpit\tile2.bmp",@TempDir&"\tile2.bmp",1)
if @compiled=1 then FileInstall("E:\Documents and Settings\PaBello\Pulpit\tile3.bmp",@TempDir&"\tile3.bmp",1)
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;                  Maded by:                           @
;                        Uriziel01                     @
;                  2008                     ;)         @
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@




;Creates your ProgressBar
;$left=position of bar from left
;$top=posiotion of bar form top
;$w=starting Width
;$h=starting Height
;$file=name of .bmp or .jpg file to use as progress bar
;$jump=jump (in pixels) of bar o each increase value by 1
;$max=maximal value of bar (in pixels)
;$color=1 for blue, 2 for green and 3 for Red
;$function=name of function that will be started when $max will be reached
;$layer= 1 or 0, this is the state of displaying label with % on top of the bar
;Example: Progress_bar_Ex(15,100,9,12,"tile2.bmp",3,220,2,"test",1)
Func Progress_bar_Ex($left,$top,$w,$h,$file,$jump=2,$max=200,$color=1,$function="",$label=0)
    Local $i=random(1,99,1),$background[100],$handler[9]
     $handler[1]= $left
     $handler[2]=$top
     $handler[3]=$w
     $handler[4]=$h
     $handler[5]=$jump
     $handler[6]=$max
     $handler[7]=$function
     $handler[8]=""
     if $label=1 then
     $handler[8] = GUICtrlCreateLabel(($w*200)/200&" %",$left+$max/2.3,$top-$h-3,80,14)
     GUICtrlSetBkColor($handler[8],$GUI_BKCOLOR_TRANSPARENT)
     GUICtrlSetFont ($handler[8],10, 900)
     endif
if $file<> "TEST" then
$handler[0] = GUICtrlCreatePic (@ScriptDir&"\"&$file, $left, $top, $w,$h)
else
    $handler[0] = GUICtrlCreatePic (@TempDir&"\tile"&$color&".bmp", $left, $top, $w,$h)
    endif
if @error=0 Then
Return $handler
Else
    Return 0
    EndIf
EndFunc
;Setting Value for our Progress
;$handle="Handle" is an array returned by Progress_bar_Ex function
;$value=value to set on function, if you will give no value, it will be 0
;$beep=frequency of beep sound to play when finished (100% reached), pass 0 to avoid any sound
;Function is returning 0 for error and 1 for OK
;Example: Progress_Set_Data($MyBar,95,500)
Func Progress_Set_Data($Handle,$value=0,$beep=0)
    if $value*$handle[5]<$handle[6] and $value*$handle[5]>=0 then 
        if $handle[8] <>0 then GUICtrlSetData($handle[8],Round(($value*$handle[5]/$handle[6])*100,0)&" %")
            if $handle[6]-($value*$handle[5]) < $handle[5]+1 then
            beep($beep,50)
        if $handle[7]<>"" then
    Call ( $handle[7])
    endif
    endif
    GUICtrlSetPos($handle[0],$handle[1],$handle[2],$handle[3]+$value*$handle[5],$handle[4])
    if @error = 0 then
    Return $value*$handle[5]
Else
    Return 0
    endif
Else
    return 0
    endif
EndFunc
;;;;;
;;;;
;;;
;;
;;
;EXAMPLE
;SIMPLE EXAMPLE OF MY PROGRESS BAR EX :)
;;
;;
;;;
;;;;
;;;;;
Global $x1=1,$y=2,$x2=1,$x3=1,$char=1
$gui=GUICreate("Progress_Bar_Ex", 400, 140,-1,-1,$WS_OVERLAPPED+$DS_SETFOREGROUND)
GUISetBkColor("0x7777AA",$gui)
$bar=Progress_bar_Ex(0,20,3,12,"TEST",1,400,3,"testt",1)
$bar2=Progress_bar_Ex(0,50,3,11,"TEST",2,400,2,"testt",1)
$bar3=Progress_bar_Ex(0,80,3,17,"TEST",2,400,1,"testt",1)
GUISetState(@SW_SHOW)
do
    $msg = GUIGetMsg()
    sleep(15)
    $set1=Progress_Set_Data($bar,$x1+35,600)
    $set2=Progress_Set_Data($bar2,$x2+15,600)
    $set3=Progress_Set_Data($bar3,$x3+27,600)
    if $set1 <> 0 then
    $x1+=1*$char
endif
    if $set2 <> 0 then
    $x2+=1*$char
endif
    if $set3 <> 0 then
    $x3+=1*$char
endif
if $x1>364 then
$char=-1
$x1=300
$x2=160
$x3=120
endif
if $x1<2 or $x2 <2 or $x3<2 then $char=1
until $msg = $GUI_EVENT_CLOSE
Func testt()
    MsgBox(0,"","MsgBox from Testt() function !")
    EndFunc
Edited by Uriziel01
Link to comment
Share on other sites

Would like to try it, but can't download the images, i get redirected to http://www.funny-games.biz/main.html.

You can upload the images on http://www.imageshack.us/

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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 UDF
 
AutoIt_Icon_small.pngExamples: 
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 Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

See my first post (super tiny images before the source code )

Those are png images :) - i reconverted them, nice example. Here is another one.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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 UDF
 
AutoIt_Icon_small.pngExamples: 
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 Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Imageshack converted them to .png

Then you can pack them into one zip archive and upload to some service, for example http://sendspace.com. Or even better, pack all together - the source and the images, and then upload :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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 UDF
 
AutoIt_Icon_small.pngExamples: 
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 Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

first error

: ==> Variable used without being declared.:

$gui=GUICreate("Progress_Bar_Ex", 400, 140,-1,-1,$WS_OVERLAPPED+$DS_SETFOREGROUND)

$gui=GUICreate("Progress_Bar_Ex", 400, 140,-1,-1,^ ERROR

I put #include <WindowsConstants.au3>

then second error

: ==> Subscript used with non-Array variable.:

if $value*$handle[5]<$handle[6] and $value*$handle[5]>=0 then

if $value*$handle^ ERROR

Link to comment
Share on other sites

Those are png images :P - i reconverted them, nice example. Here is another one.

I made an UDF for progressbars with GDIplus out of it :) . It's located in the german forum, but I will post it here, too :Phttp://www.autoit.de/index.php?page=Thread&postID=49339 Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...