3

UNICODE Progress bar for alert window, indicating progress of loop function

To indicate progress of scripts that use a loop function, I found it practical to give a visual indication of the progress using an alert window. However, HTML was not incorporatable to the alert function, so with the help of some savvy Ninox developers, we came up with the following script.

Special thanks to Leo S.

Pre-definitions:
isCount starts with zero because the loop has been carried out zero times at the start
nLoops is the amount of Loops required 
mysleep is a filler variable to simulate the actual loop function you are using 

"-------- DEFINITION VON VARIABLEN ---------";
let isCount := 0;
let goalCount := nLoops;
let mysleep := 30;
let perc := round(isCount / goalCount * 47);
let perccounter := 0;
let bartext := "";
"----- BEGINNING OF THE ACTUAL LOOP FUNCTION ----";
while isCount <= goalCount do 
    perc := round(isCount / goalCount * 47);
    "-------- THE FOLLOWING LOOP DETERMINES PROGRESS AND REPEATEDLY DRAWS █ SYMBOL UNTIL IT REPRESENTS PERCENTAGE ---------";
    while perccounter <= perc do 
        bartext := bartext + "█";
        perccounter := perccounter + 1
    end
;
    "-------- END OF THE █-BAR LOOP ---------";
    alert("ALERT:
Status: " +
    isCount +
    " / " +
    goalCount +
    " Loops carried out
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
" +
    bartext +
    "
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀" +
    if isCount = goalCount then
        "

Process complete. Please press OK"
    end);
    bartext := "";
    "############# INSERT THE ACTUAL FUNCTION WITHIN THE LOOP UNTIL isCount = goalCount FUNCTION BELOW ###################";
    sleep(mysleep);
    "############# INSERT THE ACTUAL FUNCTION WITHIN THE LOOP UNTIL isCount = goalCount FUNCTION ABOVE ###################";
    isCount := isCount + 1;
    perccounter := 0
end

Reply

null

Content aside

  • 3 Likes
  • 1 yr agoLast active
  • 194Views
  • 1 Following