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

    • NiceBoy1234
      Chain functions
      By NiceBoy1234
      I got these function but somehow only the first one gets called.

       
      test01() test02() test03() test04() test05() Func test01() While 1 ConsoleWrite("01") WEnd EndFunc Func test02() While 1 ConsoleWrite("02") WEnd EndFunc Func test03() While 1 ConsoleWrite("03") WEnd EndFunc Func test04() While 1 ConsoleWrite("04") WEnd EndFuncIs there a way to accomplish this this way?
    • Crash
      Define "auJasperatically" from AutoIt help file
      By Crash
      Hi AutoIt community!
      I have a quick question. According to AutoIt help file on Variables,
      So what the meaning of "auJasperatically destroyed"? Is it completely destroyed or might be destroyed?
       
      I am writing a security software and it is important to not let any password lingers in the memory. In a function, I have saved the password typed by user in a local var. I am not sure if I need to reset this variable before the function ends. (Or is there any better security practices?)
       
      Thanks very much!
    • NiceBoy1234
      Autoit Unknown function name
      By NiceBoy1234
      I get following error in my Script:
      Basically I have this:
         
      #include <File.au3> ... Local $sFoo_01 = "Z:\Foo\3\" Local $sFoo_02 = "Z:\Foo\6\" Local $sFoo_03 = "Z:\Foo\8\" Local $sFoo_04 = "Z:\Foo\9\" Func Test() Local $aFooNew_01 = _FileListToArray($sFoo_01, "*") Local $aFooNew_02 = _FileListToArray($sFoo_02, "*") Local $aFooNew_03 = _FileListToArray($sFoo_03, "*") Local $aFooNew_04 = _FileListToArray($sFoo_04, "*") ... EndFunc ... Local $aFooNew_01 = _FileListToArray($sFoo_01, "*") Local $aFooNew_02 = _FileListToArray($sFoo_02, "*") Local $aFooNew_03 = _FileListToArray($sFoo_03, "*") Local $aFooNew_04 = _FileListToArray($sFoo_04, "*") EDIT:
      This is not part of the code just to show where excatly the error is:
      Error: Local $aFooNew_01 = _FileListToArray($sFoo_01, "*") ^ Error  
       
    • ur
      To count number of arguments.
      By ur
      I need to write a code in which I am reading a text file which is of .vbs format and in that a line contains function signature like below
      Function CreateEnvironmentVariable($sType, $sName, $sValue, $bOverwrite)
      If the string is in above format, then I need to check number of arguments in it.
      For in above case it should return 4.
      Can anyone help me on this.
       
    • zxtnt09
      Use Function In TCP
      By zxtnt09
      Hi,
      How can i use a external function in TCPSend / TCPRecv ,
      It's meant : 
      TCPSend ( $main, function1 ) func function1 () msgbox (0,0,0) endfunc Q : Why i need to use that ? 
      A : I need when a connection was true ( connected ) , server could send some functions and client receive that,
      Me => <= You
      Thanks