Jump to content



Photo

ProgressBar with function

progress with func function bar

  • Please log in to reply
7 replies to this topic

#1 Command3r

Command3r

    Wayfarer

  • Active Members
  • Pip
  • 91 posts

Posted 19 March 2012 - 01:54 AM

hi agian :oops:, i need to make True progressbar.. you'll say "True?? How?" xD i'll tell you.

in this script:
AutoIt         
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Crypt.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 385, 125, -1, -1) $Progress1 = GUICtrlCreateProgress(32, 32, 294, 17) $Label1 = GUICtrlCreateLabel("0", 336, 33, 10, 17) $Button1 = GUICtrlCreateButton("Button1", 160, 80, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $source = @ScriptDir & "dd.exe" $save = @ScriptDir &"dd" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _Crypt_EncryptFile($source, $save, "123", $CALG_AES_256) EndSwitch WEnd

Suppose the file size is "5 MB" so it will take time to encrypt it

i need to make the progressbar loading with encrypting and finish with it too, not like this prog'

for $i = to 100 sleep(10) guictrlsetdata($progress, $i)

this progress above is not true.. i think now my problem explained :doh:

all helps appreciated.. thanks. :bye:

Edited by Command3r, 19 March 2012 - 01:58 AM.

[color=#0000ff;][font="arial, helvetica, sans-serif;"]Advice for you[/color][/font][font="arial, helvetica, sans-serif;"]: [/font][color=#000000;]Search before posting.[/color]

 

[font="arial, helvetica, sans-serif;"][color=#000000;] *********** Problem[/color] [color=#008000;]solved[/color][color=#000000;]? if yes [/color][/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"][color=#000000;]******* press "Mark Solved"[/color] [color=#006400;]button. *******[/color][/font]








#2 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,647 posts

Posted 19 March 2012 - 07:27 AM

This function does not support callbacks. Alternatively, you can encrypt a file in parts, eg parts of 64 KB, but it would be a more complex script.
  • Command3r likes this

iKey [color=#FF8C00;]|[/color] FTP Uploader [color=#FF8C00;]|[/color] Battery Checker [color=#FF8C00;]|[/color] Boot Manager [color=#FF8C00;]|[/color] Font Viewer [color=#FF8C00;]|[/color] UDF Keyword Manager [color=#FF8C00;]|[/color] Run Dialog Replacement [color=#FF8C00;]|[/color] USBProtect [color=#FF8C00;]|[/color] 3D Axis [color=#FF8C00;]|[/color] Calculator [color=#FF8C00;]|[/color] Sleep [color=#FF8C00;]|[/color] iSwitcher [color=#FF8C00;]|[/color] TM [color=#FF8C00;]|[/color] NetHelper [color=#FF8C00;]|[/color] File Types Manager [color=#FF8C00;]|[/color] Control Viewer [color=#FF8C00;]|[/color] SynFolders [color=#FF8C00;]|[/color] DLL Helper

Animated Tray Icons UDF Library [color=#FF8C00;]|[/color] Hotkeys UDF Library [color=#FF8C00;]|[/color] Hotkeys Input Control UDF Library [color=#FF8C00;]|[/color] Caret Shape UDF Library [color=#FF8C00;]|[/color] Context Help UDF Library [color=#FF8C00;]|[/color] Most Recently Used List UDF Library [color=#FF8C00;]|[/color] Icons UDF Library [color=#FF8C00;]|[/color] FTP UDF Library [color=#FF8C00;]|[/color] Script Communications UDF Library [color=#FF8C00;]|[/color] Color Chooser UDF Library [color=#FF8C00;]|[/color] Color Picker Control UDF Library [color=#FF8C00;]|[/color] IPHelper (Vista/7) UDF Library [color=#FF8C00;]|[/color] WinAPI Extended UDF Library [color=#FF8C00;]|[/color] WinAPIVhd UDF Library [color=#FF8C00;]|[/color] Icon Chooser UDF Library [color=#FF8C00;]|[/color] Copy UDF Library [color=#FF8C00;]|[/color] Restart UDF Library [color=#FF8C00;]|[/color] Event Log UDF Library [color=#FF8C00;]|[/color] NotifyBox UDF Library [color=#FF8C00;]|[/color] Pop-up Windows UDF Library [color=#FF8C00;]|[/color] TVExplorer UDF Library [color=#FF8C00;]|[/color] GuiHotKey UDF Library [color=#FF8C00;]|[/color] GuiSysLink UDF Library [color=#FF8C00;]|[/color] Package UDF Library [color=#FF8C00;]|[/color] Skin UDF Library [color=#FF8C00;]|[/color] AITray UDF Library [color=#FF8C00;]|[/color] RDC UDF Library

Appropriate path [color=#FF8C00;]|[/color] Button text color [color=#FF8C00;]|[/color] Gaussian random numbers [color=#FF8C00;]|[/color] Header's styles (Vista/7) [color=#FF8C00;]|[/color] ICON resource enumeration [color=#FF8C00;]|[/color] Menu & INI [color=#FF8C00;]|[/color] Tabbed string size [color=#FF8C00;]|[/color] Tab's skin [color=#FF8C00;]|[/color] Pop-up circular menu [color=#FF8C00;]|[/color] Progress Bar without animation (Vista/7) [color=#FF8C00;]|[/color] Registry export [color=#FF8C00;]|[/color] Registry path jumping [color=#FF8C00;]|[/color] Unique hardware ID [color=#FF8C00;]|[/color] Windows alignment

More...

Posted Image


#3 Command3r

Command3r

    Wayfarer

  • Active Members
  • Pip
  • 91 posts

Posted 19 March 2012 - 05:03 PM

@Yashied,
i add encrypting as a eg, because it takes time.. just that

but i want to know if it possible to make a true progressbar or not? and if yes, how can i do that???

[color=#0000ff;][font="arial, helvetica, sans-serif;"]Advice for you[/color][/font][font="arial, helvetica, sans-serif;"]: [/font][color=#000000;]Search before posting.[/color]

 

[font="arial, helvetica, sans-serif;"][color=#000000;] *********** Problem[/color] [color=#008000;]solved[/color][color=#000000;]? if yes [/color][/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"][color=#000000;]******* press "Mark Solved"[/color] [color=#006400;]button. *******[/color][/font]


#4 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,993 posts

Posted 19 March 2012 - 05:30 PM

It's possible to program a progress bar that increments or decrements depending upon what the script is doing. It depends on what the script is doing if it's possible to update the progress bar as it's doing it. If you're, for an example, using FileCopy, there's no way to do it, because that function doesn't update you as to how much is being copied or how much has been copied, so there's no way to make an accurate progress bar or update it accurately. If on the other hand, you're using FileCopy to copy 100 files, you can update the progress bar after each individual file has been copied but not during the copy process.

So, to shorten that up, depending upon what you're timing it's either possible to do it, or you'll need to use a workaround to do it.
  • Command3r likes this

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

[color=rgb(255,140,0);]Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude[/color]

 

How to ask questions the smart way!

 

[color=rgb(255,0,0);]Back up and restore Windows user files[/color] [color=rgb(255,0,0);]_Array.au3[/color] - Modified array functions that include support for 2D arrays.[color=rgb(255,0,0);]ColorChooser[/color] - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
[color=rgb(255,0,0);]Customizable Splashscreen GUI w/Progress Bar[/color] - Create a custom "splash screen" GUI with a progress bar and custom label.
[color=rgb(255,0,0);]_FileGetProperty[/color] - Retrieve the properties of a file [color=rgb(255,0,0);]SciTE Toolbar[/color] - A toolbar demo for use with the SciTE editor[color=rgb(255,0,0);]GUIRegisterMsg demo[/color] - Demo script to show how to use the Windows messages to interact with controls and your GUI.
[color=rgb(255,0,0);]GUIToolTip UDF Demo[/color] - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

[color=rgb(0,128,0);]I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.[/color]


#5 Command3r

Command3r

    Wayfarer

  • Active Members
  • Pip
  • 91 posts

Posted 19 March 2012 - 05:38 PM

It's possible to program a progress bar that increments or decrements depending upon what the script is doing. It depends on what the script is doing if it's possible to update the progress bar as it's doing it. If you're, for an example, using FileCopy, there's no way to do it, because that function doesn't update you as to how much is being copied or how much has been copied, so there's no way to make an accurate progress bar or update it accurately. If on the other hand, you're using FileCopy to copy 100 files, you can update the progress bar after each individual file has been copied but not during the copy process.

So, to shorten that up, depending upon what you're timing it's either possible to do it, or you'll need to use a workaround to do it.


you can update the progress bar after each individual file has been copied but not during the copy process.



okay :oops:, nice idea :doh:
but what about using that in encrypting??

do i need to get the original file size, and the file is encrypting?? then compare???

any script please?

ty :bye:

[color=#0000ff;][font="arial, helvetica, sans-serif;"]Advice for you[/color][/font][font="arial, helvetica, sans-serif;"]: [/font][color=#000000;]Search before posting.[/color]

 

[font="arial, helvetica, sans-serif;"][color=#000000;] *********** Problem[/color] [color=#008000;]solved[/color][color=#000000;]? if yes [/color][/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"][color=#000000;]******* press "Mark Solved"[/color] [color=#006400;]button. *******[/color][/font]


#6 Command3r

Command3r

    Wayfarer

  • Active Members
  • Pip
  • 91 posts

Posted 19 March 2012 - 05:59 PM

any ideas?

[color=#0000ff;][font="arial, helvetica, sans-serif;"]Advice for you[/color][/font][font="arial, helvetica, sans-serif;"]: [/font][color=#000000;]Search before posting.[/color]

 

[font="arial, helvetica, sans-serif;"][color=#000000;] *********** Problem[/color] [color=#008000;]solved[/color][color=#000000;]? if yes [/color][/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"][color=#000000;]******* press "Mark Solved"[/color] [color=#006400;]button. *******[/color][/font]


#7 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,993 posts

Posted 19 March 2012 - 06:04 PM

I'd use GUICtrlCreateProgress and use the $PBS_MARQUEE style to create a scrolling progress bar for anything that you can't get direct information from, such as the encrypt routines or filecopy. This way the user knows something is going on in the background. For an example of an easy way to do it, there's a link in m signature to a UDF that can be used to create a GUI with a label and progress bar.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

[color=rgb(255,140,0);]Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude[/color]

 

How to ask questions the smart way!

 

[color=rgb(255,0,0);]Back up and restore Windows user files[/color] [color=rgb(255,0,0);]_Array.au3[/color] - Modified array functions that include support for 2D arrays.[color=rgb(255,0,0);]ColorChooser[/color] - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
[color=rgb(255,0,0);]Customizable Splashscreen GUI w/Progress Bar[/color] - Create a custom "splash screen" GUI with a progress bar and custom label.
[color=rgb(255,0,0);]_FileGetProperty[/color] - Retrieve the properties of a file [color=rgb(255,0,0);]SciTE Toolbar[/color] - A toolbar demo for use with the SciTE editor[color=rgb(255,0,0);]GUIRegisterMsg demo[/color] - Demo script to show how to use the Windows messages to interact with controls and your GUI.
[color=rgb(255,0,0);]GUIToolTip UDF Demo[/color] - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

[color=rgb(0,128,0);]I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.[/color]


#8 Command3r

Command3r

    Wayfarer

  • Active Members
  • Pip
  • 91 posts

Posted 19 March 2012 - 06:20 PM

i like the 2nd progress :oops: im gonna try it and tell you.

thanks. :bye:

[color=#0000ff;][font="arial, helvetica, sans-serif;"]Advice for you[/color][/font][font="arial, helvetica, sans-serif;"]: [/font][color=#000000;]Search before posting.[/color]

 

[font="arial, helvetica, sans-serif;"][color=#000000;] *********** Problem[/color] [color=#008000;]solved[/color][color=#000000;]? if yes [/color][/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"][color=#000000;]******* press "Mark Solved"[/color] [color=#006400;]button. *******[/color][/font]






Also tagged with one or more of these keywords: progress, with, func, function, bar

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users