Sign in to follow this  
Followers 0
Anaxibius

Progress Bar Question

12 posts in this topic

#1 ·  Posted (edited)

I found this code in searching for a progress bar. Could someone please explain to me what it is actually doing? I have seen the line "If $CmdLine[0] = 0 Then Exit" in other scripts to keep windows open while they execute, but I am not certain what is actually taking place to do this? Is it something built into AutoIT or is it something created within the script?

If $CmdLine[0] = 0 Then Exit
If Not WinExists("Splash") Then Splash()
ControlSetText("Splash","","Static1",$CmdLine[1])
Exit

Func Splash()
   $WS_CAPTION = 12582912
   $WS_DISABLED = 134217728
   $SS_CENTER = 1
   Opt("RunErrorsFatal",0)

   EnvSet("GUI.title","Splash")
   EnvSet("GUI.style",BitOR($WS_CAPTION,$WS_DISABLED))
   EnvSet("GUI.w",240)
   EnvSet("GUI.h",120)
   EnvSet("OBJ1.type","label")
   EnvSet("OBJ1.w",240)
   EnvSet("OBJ1.h",120)

   Run("AU3GUI")
   WinWait("Splash","",5)
EndFunc
Edited by Anaxibius

Share this post


Link to post
Share on other sites



I found this code in searching for a progress bar. Could someone please explain to me what it is actually doing? I have seen the line "If $CmdLine[0] = 0 Then Exit" in other scripts to keep windows open while they execute, but I am not certain what is actually taking place to do this? Is it something built into AutoIT or is it something created within the script?

not sure where you got that code from, but it's not a good one to use for easy implementation. It looks like you may have taken it out of someone else's autoitx script that implemented a progress bar, but out of the context that it was written for, it's syntaxually wrong for autoit3, and doesn't actually DO anything. look in the help file for ProgressOn() ProgressSet() ProgressOff() for usable examples. that you can modify and learn from.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Whoever wrote this was looking at giving the commands to another Au3.exe, and then after having that Au3.exe run was going to do something else when the splash screen on the sent to Au3.exe rec'd the information from this Au3.exe ... Confusing? Yes about as much as the code you provided :P


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

not sure where you got that code from, but it's not a good one to use for easy implementation. It looks like you may have taken it out of someone else's autoitx script that implemented a progress bar, but out of the context that it was written for, it's syntaxually wrong for autoit3, and doesn't actually DO anything. look in the help file for ProgressOn() ProgressSet() ProgressOff() for usable examples. that you can modify and learn from.

Ok. I found the commands you are talking about. The following code is listed in the help file
ProgressOn("Progress Meter", "Increments every second", "0 percent")
For $i = 10 to 100 step 10
    sleep(1000)
    ProgressSet( $i, $i & " percent")
Next
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()

Say I wanted to copy a directory using the DirCopy command and I wanted a prgress bar to show the progress(go figure) how would I incorporate the copy into the script above?

Share this post


Link to post
Share on other sites

I don't see being able to set a 'progress bar' without re-writing your own DirCopy() function with something like FileFindFirstFile()/FileFindNextFile().


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Whoever wrote this was looking at giving the commands to another Au3.exe, and then after having that Au3.exe run was going to do something else when the splash screen on the sent to Au3.exe rec'd the information from this Au3.exe ... Confusing? Yes about as much as the code you provided :P

That is the history of the GUI. What you see is code for Larry's AU3GUI application. It was originally a seperate application which read environment variables in order to create the GUI's. This was the foundation for the GUI that exists built-into AutoIt today.

Share this post


Link to post
Share on other sites

That is the history of the GUI. What you see is code for Larry's AU3GUI application. It was originally a seperate application which read environment variables in order to create the GUI's. This was the foundation for the GUI that exists built-into AutoIt today.

Very Cool!


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I guess I am just too slow to get this stuff. The link you posted looks great. It makes sense on a conceptual level, but I am getting a compiler error.

Error: C:\Documents and Settings\xupd48clr\My Documents\AutoIT Scripts\Progress_Bar.au3(97,16) : ERROR: $sIstr already declared as parameter

Local $sIstr,

~~~~~~~~~~~~~~~^

C:\Documents and Settings\xupd48clr\My Documents\AutoIT Scripts\Progress_Bar.au3(97,22) : ERROR: $bSF already declared as parameter

Local $sIstr, $bSF,

~~~~~~~~~~~~~~~~~~~~~^

Can I just continue anyway? When I try to pass the $sOriginalDir and $sDestDir it doesn't seem to do anything.

Share this post


Link to post
Share on other sites

I guess I am just too slow to get this stuff. The link you posted looks great. It makes sense on a conceptual level, but I am getting a compiler error.

Can I just continue anyway? When I try to pass the $sOriginalDir and $sDestDir it doesn't seem to do anything.

just remove the line referenced in the error. as the variable is already a parameter in the function, there is no need to declare it again.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Nevermind...I am so new to this I didn't realize the original script doesn't actually perform the function. Compared the original to one that he gives a specific example with later and found the function call at the end.

Share this post


Link to post
Share on other sites

I am still fiddling around with the script you copied the link to http://www.autoitscript.com/forum/index.ph...pic=11313&st=15. I can run this with a batch file and it works perfectly. It does exactly what I want it to, but I try to call it from within a script and fails witha return code of 0 every time.

The line that is failing is as follows:

RunWait('X:\CLAAS\Progress_Bar.exe "X:\CLAAS\v2.5.8" "C:\CLAASCAT"')

I set it as a variable and displayed a message box to verify the location was correct. All drive mappings are in place. The code for the Progress_Bar.exe can be seen at the above link. The reason I am using mapped drives is that I had no luck using UNC paths. I am not sure if the paths were too long or something, so if I am way off base please let me know.

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