Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


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.

Advice for you: Search before posting.

 

 *********** Problem solved? if yes  *********

******* press "Mark Solved" button. *******








#2 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,574 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

#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???

Advice for you: Search before posting.

 

 *********** Problem solved? if yes  *********

******* press "Mark Solved" button. *******


#4 BrewManNH

BrewManNH

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

  • MVPs
  • 10,448 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.

 

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

 

How to ask questions the smart way!

 

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

 

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.


#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:

Advice for you: Search before posting.

 

 *********** Problem solved? if yes  *********

******* press "Mark Solved" button. *******


#6 Command3r

Command3r

    Wayfarer

  • Active Members
  • Pip
  • 91 posts

Posted 19 March 2012 - 05:59 PM

any ideas?

Advice for you: Search before posting.

 

 *********** Problem solved? if yes  *********

******* press "Mark Solved" button. *******


#7 BrewManNH

BrewManNH

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

  • MVPs
  • 10,448 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.

 

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

 

How to ask questions the smart way!

 

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

 

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.


#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:

Advice for you: Search before posting.

 

 *********** Problem solved? if yes  *********

******* press "Mark Solved" button. *******






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