Sign in to follow this  
Followers 0
Command3r

ProgressBar with function

8 posts in this topic

#1 ·  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

[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]

Share this post


Link to post
Share on other sites



Share this post


Link to post
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]

Share this post


Link to post
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.

1 person 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 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

Share this post


Link to post
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]

Share this post


Link to post
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]

Share this post


Link to post
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

Share this post


Link to post
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]

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

  • Similar Content

    • ling3882688
      How to get this 7-Zip progress?
      By ling3882688
      There is an Example called _7ZIPExtractEx_Example_using_Callback.AU3 in the 7-Zip UDF.
      I found a problem. If one file in the 7z archive is too big,the progress  bar will stop for a long time.
      How can I get the exact progress even though there are big files in the archive?
      In other words,how to get the exact extracted file size without delay  ?
      7Zip_UDF.zip
    • DrAhmed
      [Solved] Calculate/Compare Functions speed ?
      By DrAhmed
      Hey 
      I've these two functions to do a base64 conversation , Is there any way to compare the exact speed of both of them ?
      Func _Base64Encode($input) $input = Binary($input) Local $struct = DllStructCreate("byte[" & BinaryLen($input) & "]") DllStructSetData($struct, 1, $input) Local $strc = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") ; error calculating the length of the buffer needed EndIf Local $a = DllStructCreate("char[" & DllStructGetData($strc, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error encoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>_Base64Encode  
      Func _Base64Encode($sData) Local $oXml = ObjCreate("Msxml2.DOMDocument") If Not IsObj($oXml) Then SetError(1, 1, 0) EndIf Local $oElement = $oXml.createElement("b64") If Not IsObj($oElement) Then SetError(2, 2, 0) EndIf $oElement.dataType = "bin.base64" $oElement.nodeTypedValue = Binary($sData) Local $sReturn = $oElement.Text If StringLen($sReturn) = 0 Then SetError(3, 3, 0) EndIf Return $sReturn EndFunc ;==>_Base64Encode  
    • afallenhope
      How to enable a window?
      By afallenhope
      Hello all I am trying to use this function to detect if a specific window is running. Then for it to activate it and send an ALT+F command to close the window. But I cannot seem to get it to detect the window and subsequently the rest of the code does not work. 
      #include <MsgBoxConstants.au3> Handleit() Func Handleit() If WinExists("[CLASS:MsiDialogCloseClass]","InstallShield") Then WinActivate("[CLASS:MsiDialogCloseClass]","Installshield") Send("!f") Else MsgBox($MB_SYSTEMMODAL, "", "Uhhh... something didn't work. Fix it!") EndIf EndFunc Is there anything that I can substitute for the CLASS? 
      Thank you for taking the time to read my question! 
      -Richard
    • rm4453
      (SOLVED)Calling Function That Calls Original Function
      By rm4453
      How would I get this code to work? If not possible/If there is a better way... How would I do it? I can't seem to get it to work properly...
       
      Func Go() ;Do stuff Re-Go() EndFunc Func Re-Go() Go() EndFunc  
    • 31290
      Strange progress behavior
      By 31290
      Hi everyone
      Hope you're doing great.
      Well, I'm writing a script that allows our Service Desk to clean several temp folder as a first diagnostic. 
      Indeed, the agent in charge of the issue will have to choose what to clean (web browsers temp folders, some windows one etc...)
      I added a progress bar to see the current state of the script but if I select more than one checkbox, it seems that the counting is not done properly and is directly filled at 100% (when at leat 2 boxes are checked) and I don"t get the final message saying that all is done, especially for if the last box is checked.
      But if I launch the process with only one checkbox checked,it's working...
      I've enclosed the au3 files for you because posting them in this post would be... unreadable lol. So you can maybe do some tests as well.
      I'm pretty sure the code can be optimized (a lot  ) and that there is a much better way to achieve what I want the script to be.
      Maybe can someone can give me a hand over here.
      Thanks in advance.
      31290
      SEE_Delete_Temp.au3
      SEE_Delete_Temp_Functions.au3