Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > PocketBook > PocketBook Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-22-2025, 02:28 PM   #1
neil_swann80
0000000000101010
neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.
 
neil_swann80's Avatar
 
Posts: 5,877
Karma: 12981955
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
Progress bar GUI for scripts

I've fudged together a simple progress bar GUI I use for some of my install and backup scripts and thought others may find a use for it.
It uses existing PocketBook system resources, so no additional files required.
Just save the code below as an .app file in /mnt/ext1/applications

Here's the code:
Spoiler:

(you may need to scroll down to see all)
Code:
#!/bin/sh

#### Tweak as required ####
progBarLength=40
progBarUnitSize=8
# length/UnitSize = number of times outputProgress will need
# to be called to fill progress bar.  (e,g, 40/8=5)
messageRunning="Process running, please wait..."
messageComplete="Process Complete!"
####

# display background and progress bar
dialog=/ebrmain/cramfs/bin/dialog
progBar="$(printf '%*s' $progBarLength "" | tr ' ' '_')"
emptyUnit=$(printf '%*s' $progBarUnitSize "" | tr ' ' '_')
fullUnit=$(printf '%*s' $progBarUnitSize "" | tr ' ' '=')
i=1; outputProgress() {
background="/ebrmain/bin/run_script -clear_screen -bitmap=progress_gear_$i"
let "i=i+1"; if [ $i == 5 ]; then i=1; fi
$background; iv2sh SetActiveTask $$
($dialog 1 "" "$messageRunning" "Progress: $progBar") &
progBar=${progBar/$emptyUnit/$fullUnit}
sleep 1; }; outputProgress

#### add your code sections between function calls ####
# insert your code
outputProgress #1
# insert your code
outputProgress #2
# insert your code
outputProgress #3
# insert your code
outputProgress #4
# insert your code
outputProgress #5
####

# confirmation and exit
/ebrmain/bin/run_script -clear_screen -bitmap=congrat_icon_up
iv2sh SetActiveTask $$; $dialog 3 "" "$messageComplete" "" "ok" ""
iv2sh SetActiveTask `pidof bookshelf.app`; pkill -f /bin/sh
exit

It can be ran as-is to demo. I'd be interested to know what it looks like on different devices.
Works in regular and dark-mode... actually looks a little better in the latter.

Screenshots attached...
Attached Thumbnails
Click image for larger version

Name:	inst_active.jpg
Views:	61
Size:	53.8 KB
ID:	215226   Click image for larger version

Name:	inst_comp.jpg
Views:	55
Size:	46.3 KB
ID:	215227  
neil_swann80 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Progress bar? Pjama Kindle Developer's Corner 2 04-06-2022 10:57 AM
Progress bar: this unknown. (chapter progress) gabryele Kobo Reader 23 12-14-2019 06:02 PM
Progress bar? frogette Which one should I buy? 13 10-18-2014 04:01 AM
remove Progress bar at K4 NT. rtzui Amazon Kindle 0 10-21-2013 09:58 AM
GUI Frontend for python scripts [windows] - seeking mod input first sherman Workshop 7 04-27-2009 01:04 AM


All times are GMT -4. The time now is 10:45 AM.


MobileRead.com is a privately owned, operated and funded community.