This progress bar
Here is a variant with crutches script.xml (with normal global variables and normal conditions)
And for the option without crutches, I slightly tweaked the function:
progressbar = function (val, max) {
var SettingsProgressbar = JSON.parse(P("basglobal", "SETTINGSPROGRESSBAR")) //прочитали настройки из глобальной переменной
if (!SettingsProgressbar[(thread_number() - 1)]) SettingsProgressbar[(thread_number() - 1)] = {}
SettingsProgressbar[(thread_number() - 1)].val = val
SettingsProgressbar[(thread_number() - 1)].max = max
PSet("basglobal", "SETTINGSPROGRESSBAR", (JSON.stringify(SettingsProgressbar))) //обновили настройки
for (var i = 0; i <= SettingsProgressbar.length - 1; i++) { //проходим циклом все объявленные статус бары
if (SettingsProgressbar[i]) { //если статусбар данного потока существует
var res = parseInt(SettingsProgressbar[i].val * 1000 / SettingsProgressbar[i].max)
if (SettingsProgressbar[i].val == 0) log_html('<table style="border-color:#000000" width="1000" cellspacing="0" cellpadding="4" border="0"><tr><td bgcolor="#F0FFF0"</td></tr></table>')
if (SettingsProgressbar[i].val >= SettingsProgressbar[i].max) log_html('<table style="border-color:#000000" width="1000" cellspacing="0" cellpadding="4" border="0"><tr><td bgcolor="' + SettingsProgressbar[i].color + '"</td></tr></table>')
if (SettingsProgressbar[i].val != 0 && SettingsProgressbar[i].val < SettingsProgressbar[i].max) log_html('<table style="border-color:#000000" width="1000" cellspacing="0" cellpadding="4" border="0"><tr><td bgcolor="' + SettingsProgressbar[i].color + '" width="' + res + '"></td><td bgcolor="#F0FFF0" ></td></tr></table>')
log_html(" ")
}
}
}
Removed the color definition inside the stream (this is not convenient, since you have to create a bunch of conditions in the script).
Instead, moved the definition of colors for all statusbars to the global array of objects SETTINGSPROGRESSBAR , which is declared in the OnApplicationStart function and fills in the colors for all statusbars from the [[NEW_LIST]] array in the same place
0_1568292795342_395e1e4b-fa62-452b-bb2b-390f1d11c3ec-image.png
0_1568292823407_d6789c2f-24fe-42a7-9062-3a4fed358d7a-slike.png
in the function itself, I added a drawing cycle with a condition, in case not all threads have started work yet:
0_1568293322087_support148.gif
Test script
@Fox can you make this into a module xD