Jump to content

Value of Progress bar control


Recommended Posts

I've been looking around for examples, but have not found any as yet.

I want to know what the value of a progress bar is. I want to use this in more than one application, but an example would be during a backup using NTBackup. I assumed I would have to use one of the control tools, but for the life of me I have no idea where to start. I did run the Window Info Tool, and it provided the following info...

Press CTRL-ALT-F to pause the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<
Title:  Backup Progress
Class:  #32770
Size:   X: 148  Y: 43   W: 347  H: 393

>>>>>>>>>>> Mouse Details <<<<<<<<<<<
Screen: X: 421  Y: 249
Cursor ID:  2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<
RGB:    Hex: 0xFFFFFF   Dec: 16777215

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<
Size:       X: 96   Y: 174  W: 234  H: 15
Control ID: 1025
ClassNameNN:    msctls_progress321
Text:       

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<


>>>>>>>>>>> Visible Window Text <<<<<<<<<<<
Cancel
Label:
Preparing to backup using shadow copy...
Drive:
Status:
Progress:
Processing:
Time:
Files:
Bytes:
Elapsed:
0
0
Processed:

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<
&Close
&Report...
0
0
Estimated remaining:
Estimated:
The backup is complete.
The restore is complete.
To see detailed information, click Report.

Could someone point me in the right direction?

Link to comment
Share on other sites

Something like the following should do it:

Const $WM_USER = 0x400
Const $PBM_GETPOS = ($WM_USER+8)
$h_progress = ControlGetHandle("Backup Progress","","msctls_progress321")
$ret = DllCall("user32.dll","int","SendMessage","hwnd",$h_progress,"int",$PBM_GETPOS,"int",0,"int",0)
MsgBox(0,"Percent",$ret[0])

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Thanks for the quick reply... and really I appreciate the code... but I would also like to understand what its doing...

Would you mind commenting each line?

For your reference, I am a well versed in Kixtart and Shell Scripting, but I've not quite got my hands around AutoIt yet... but I want to. :)

Thanks for your time.

Link to comment
Share on other sites

From the help file:

ControlGetHandle

--------------------------------------------------------------------------------

Retrieves the internal handle of a control

DllCall

--------------------------------------------------------------------------------

Dynamically calls a function in a DLL.

From MSDN:

http://msdn.microsoft.com/library/default..../pbm_getpos.asp

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

The DLLCall is a little over my head, and have no idea why the constant values are defined as they are... but moving on to my next question. Your script worked very well within AutoIT, however now I am trying to convert it to Kixtart and use AutoItX. My converted script errors out on the DLLCall line, and unless I'm missing it, DLLCall does not appear to be one of the methods in the control. Is this correct, and if so, is there another method that would allow me to do it?

Thanks

Link to comment
Share on other sites

I dont think that DllCall() is a KixStart function. (I am not positive I grasped your meaning).

Why would you want it to be in Kix when it works perfectly well in AutoIt?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I dont think that DllCall() is a KixStart function. (I am not positive I grasped your meaning).

Why would you want it to be in Kix when it works perfectly well in AutoIt?

JS

<{POST_SNAPBACK}>

Well... not to ruffle anyone's feathers around here, but KiXtart is my main tool of choice. :) I'm sure most of you know what I mean when I say I would like to keep everything within the script, not having to call EXEs, etc, nor do I want to re-write all my scripts to AutoIT. That being said, I was hoping to convert the script above using AutoItX... and everything worked until it got to the dllcall, which I don't think is something AutoItX supports, although I hope I am wrong and someone can point me in the right direction.

Here is the script if anyone is interested.

break on
$WM_USER = &400
$PBM_GETPOS = $WM_USER+8

$AutoIt=CreateObject("AutoItX3.Control")
? @error
while $ret<=100
  $h_progress = $Autoit.ControlGetHandle("Backup Progress","","msctls_progress321")
? @error
  $ret = $Autoit.DllCall("user32.dll","int","SendMessage","hwnd",$h_progress,"int",$PBM_GETPOS,"int",0,"int",0)
? @error
  $ret
  sleep 0.2
  chr(13)  
loop
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...