Sign in to follow this  
Followers 0

ProgressBar with function


8 posts in this topic

Posted (edited)

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

in this script:

#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

Share this post


Link to post
Share on other sites



Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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:

Share this post


Link to post
Share on other sites

Posted

any ideas?

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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

thanks. :bye:

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  
Followers 0