Bruce Phillips has posted his BP Progress application and script to ScriptBuilders, and I have written a demo script that puts it through its paces with a real task, showing how to integrate it into a script. Try it out; enjoy.
-- initialize BP Progress
---------------------
-- **** the next line must be edited to point to wherever you actually put ProgressBar. ****
---------------------
set ProgressBar to load script alias (((path to scripts folder) as text) & "BP Progress:BP Progress Bar Controller.scpt")
tell ProgressBar to initialize("BB_System_Setup") -- put name of script here (same as title bar of script)
-- Start of Script to use ProgressBar Controller
tell ProgressBar
barberPole(true)
setStatusTop to "Initializing System Profile Scan"
setStatusBottom to "Only a moment..."
end tell
set AllData to {}
-- Get the available data types for system profiler
set SysDat to (do shell script "system_profiler -ListDataTypes")
-- Build a list of them, excluding the first header line
set SysDat to paragraphs 2 thru -1 of SysDat
-- Extract some labels for the categories from their names
set SDC to count of SysDat
set SysCat to {} -- to hold the labels
repeat with k from 1 to SDC
set end of SysCat to characters 3 thru -9 of item k of SysDat as string
end repeat
-- Stop the barber pole, set up for the progress bar
tell ProgressBar
barberPole(false)
setMax to 22 -- to match the items to be processed below
setStatusTop to "Collecting System Data"
end tell
-- Run the loop that collects each item
repeat with j from 1 to 21 -- Some of the last items in SysDat take too long, looks better short 1
tell ProgressBar
setStatusTop to "Collecting System Data: " & item j of SysCat
setStatusBottom to "System Profiler's " & item j of SysDat
end tell
set thisDat to do shell script "system_profiler " & item j of SysDat
set end of AllData to thisDat
tell ProgressBar to increase by 1
end repeat
tell ProgressBar to quit
AllData as string