Hi,
Corrected script. You should divide current value with 1 percent not multiply
by 1 percent.
Alternatively multiply current value by 100 and divide by max value
Sorry, my English is not so good to write long emails but if you wish to ask
I'll do my best.
HTH
Artur
int function GetProgressValue ()
var
object oUIA,
object oElement,
object oCondition,
int iValue,
int iMax,
int iMin
oUIA = CreateObjectEx ("FreedomSci.UIA", 0, "UIAScriptAPI.x.manifest" )
oElement = oUIA.GetElementFromHandle(GetAppMainWindow(GetFocus()))
oCondition = oUIA.CreateStringPropertyCondition(UIA_ClassNamePropertyId,
"msctls_progress32") oElement = oElement.findFirst (treeScope_descendants,
oCondition) if oElement then iMin = oElement.GetRangeValuePattern().Minimum
iMax = oElement.GetRangeValuePattern().Maximum
iValue = oElement.GetRangeValuePattern().Value
; both modified lines give correct result
; 1
;iValue = ((iValue* 100 )/iMax)
; 2
iValue = iValue / (iMax / 100)
; SayInteger (iMin)
;SayInteger (iMax)
; SayInteger (iValue)
Return iValue
EndIf
EndFunction
Script SayValue ()
SayInteger (GetProgressValue ())
EndScript
-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx <jawsscripts-bounce@xxxxxxxxxxxxx> On
Behalf Of Udo Egner-Walter
Sent: Saturday, September 26, 2020 7:21 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Progress bar in Explorer
Hello all,
I am currently creating some scripts for the Windows Explorer. I'm trying to
calculate the percentage of the progress bar that appears when you search for
files.
Isn't it true that the current value has to be below the maximum value? In my
example I divided the maximum value by 100 to get one percent and then
calculate the current value (multiply the result of one percent and actual
value).
But almost all the time the current value is above the maximum value. Do I have
an error in thinking here or is this a peculiarity of the Explorer? If you
search many files and look at the progress bar, you can often see that the bar
is almost full although many more files are being searched.
Does anyone have an idea about this? I have added the code I used at the end,
in case someone wants to test it for himself. The announcement of the values
for minimum (SayInteger (iMin)), for maximum (SayInteger (iMax)) and for the
current value (SayInteger (iValue)) I commented out.
Thanks a lot for suggestions and comments
Udo
P. S. Here's the function with calling script:
int function GetProgressValue ()
var
object oUIA,
object oElement,
object oCondition,
int iValue,
int iMax,
int iMin
oUIA = CreateObjectEx ("FreedomSci.UIA", 0, "UIAScriptAPI.x.manifest" )
oElement = oUIA.GetElementFromHandle(GetAppMainWindow(GetFocus()))
oCondition = oUIA.CreateStringPropertyCondition(UIA_ClassNamePropertyId,
"msctls_progress32") oElement = oElement.findFirst (treeScope_descendants,
oCondition) if oElement then iMin = oElement.GetRangeValuePattern().Minimum
iMax = oElement.GetRangeValuePattern().Maximum
iValue = oElement.GetRangeValuePattern().Value
iValue = (iMax / 100) * iValue
; SayInteger (iMin)
; SayInteger (iMax)
; SayInteger (iValue)
Return iValue
EndIf
EndFunction
Script SayValue ()
SayInteger (GetProgressValue ())
EndScript
__________�
View the list's information and change your settings at
//www.freelists.org/list/jawsscripts
__________�
View the list's information and change your settings at
//www.freelists.org/list/jawsscripts