Jump to content

ProgressBar with function


Recommended Posts

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

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

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

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

Link to comment
Share on other sites

Link to comment
Share on other sites

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

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

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

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

Link to comment
Share on other sites

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.

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 XP, 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!

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.

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 editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

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:

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

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

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

Link to comment
Share on other sites

any ideas?

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

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

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

Link to comment
Share on other sites

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 XP, 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!

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.

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 editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

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

thanks. :bye:

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

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

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

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

×
×
  • Create New...