[Closed] progBar.value
hi:
excuse me,I have 2 doubts,i need some help,
Question 1:
the” progressBar ** _progBar “
The processing the ** _progBar.value =?
how can be defined as:
**_progBar.value = the current whole script or part of a script processed value ?
It can automatically displays the process value.
in my silly way:
**_progBar.value=10
**_progBar.value=20
**_progBar.value=30
**_progBar.value=40
…
**_progBar.value=100
**_progBar.value=0
but is my manually add is feeling so silly … i need an automatically displays the process value.
how can i do?
Question 2:
i want to put the max common parameters – render output size “width” / “height” and “image aspect lock” to my scirpt tools Panel.
how can i do?
My English is not so good, I spent a long time to write this post.
can anyone got any tips for me? thanks somuch!
I used a Radiobutton in a script which only need a few settings
case rdoSize.state of
(
1: [renderWidth = 1920, renderHeight = 1080]
2: [renderWidth = 1280, renderHeight = 720]
3: [renderWidth = 720, renderHeight = 576]
4: [renderWidth = 240, renderHeight = 192]
)
I hope this helps.
The rest will need to come from more experienced macscripters
progress bar always cooperated with a for loop , in this case , a index needed when get each items :
rollout test "test "
(
button btTest "bt Test "
progressbar pbA ""
on btTest pressed do
(
-- make a array for test . normally u may store objects in this array.
local aArray = for i in 1 to 1000 collect i
-- loop , show progressbar ruler moving .
local ArrayCount = aArray.count
for j in 1 to ArrayCount do
(
-- the 100.0 forced the ruler show in float .
pbA.value = 100.0 * ( j / ArrayCount )
)
)
)createdialog test
thanks, this is a good Method.
but
if i want to make some very long script as ” one function “
like: a Section script, a behavior ,or in one time Operations,
instead of calculate how much amount, or how much Material number.
Whether what is the long script is,
and show the progress in running, no like crash.
it can be do?
progressBar can not be embed into a function , it defined like a global variable in a rollout container .
If u just want show the progress when function running , why not use “print ” as a alternetive idea .
combined with clearListener () and print command , in result is same .
fn showResult =
(
– ur code …
– show progress .
theProgress = … as string
clearlistener ()
print theProgress
)
print is global , u can use it in any place .
progressbar control defines as any other rollout control as local to the rollout scope if you don’t do anything special to make it global.
of course any rollout control (including progressbar) can be passed as argument to any function:
try(destroydialog MacrosRol) catch()
rollout MacrosRol "Check Macros" width:200
(
button get_bt "Check Macroscripts" width:190 offset:[0,0]
progressbar pb width:190 height:9 color:orange offset:[-8,-3]
label lb
fn getMacroFiles progressControl: outputControl: =
(
progressControl.value = 0
files = getfiles (getdir #ui + @"\macroscripts\*.mcr")
lines = 0
for k=1 to files.count do
(
file = files[k]
outputControl.text = filenamefrompath file
ss = (dotnetclass "System.IO.File").ReadAllLines file
lines += ss.count
progressControl.value = 100.0 * k / files.count
)
outputControl.text = "files = " + files.count as string + " ( lines = " + lines as string + " )"
files
)
on get_bt pressed do getMacroFiles progressControl:pb outputControl:lb
)
createdialog MacrosRol
cool denisT .
thanks for u correct my mistake . I review the “paremeters” in max script help document , max script trans paremeters as reference mode in default , that is a Pointer .
thanks :bowdown: