Progress Bar Help

So I know what your thinking…OMG! Its Jesse…and hes actually…using the forums!! Yeah yeah I know, calm down…

Anyways, I just ran through Ben’s great tutorial on making a progress bar. Now, I need to add my code into this. This is where I get stuck. A little info on my code…

This is for my Automator Action Maintenance. The actual action uses Applescript to run. Here is the current versions code:

set the task_titles to {"Repair Permissions", "Verify Preference Files", "Periodic Cleanup", "Update Prebindings", "Clear Cache Files", "Update Locate Database", "Update Whatis Database", "Rebuild LaunchServices Database"}
set the code_list to {"sudo diskutil repairPermissions / >> ~/Desktop/Maintenance_Results", "sudo plutil ~/Library/Preferences/*.plist >> ~/Desktop/Maintenance_Results; sudo plutil /Library/Preferences/*.plist >> ~/Desktop/Maintenance_Results", "sudo periodic daily weekly monthly >> ~/Desktop/Maintenance_Results", "sudo update_prebinding -root / >> ~/Desktop/Maintenance_Results", "sudo rm -r ~/Library/Caches/* >> ~/Desktop/Maintenance_Results; sudo rm -r /Library/Caches/* >> ~/Desktop/Maintenance_Results; sudo rm -r /System/Library/Caches/* >> ~/Desktop/Maintenance_Results", "sudo /usr/libexec/locate.updatedb >> ~/Desktop/Maintenance_Results", "sudo /usr/libexec/makewhatis -v -L $MANPATH; >> ~/Desktop/Maintenance_Results", "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user; >> ~/Desktop/Maintenance_Results"}
set the chosen_tasks to (choose from list task_titles with prompt "Select the tasks to execute
(Use Apple key to select multiple items)" with multiple selections allowed)
if the chosen_tasks is false then error number -128
set the command_string to ""
repeat with i from 1 to the count of the chosen_tasks
	set this_task to item i of the chosen_tasks
	repeat with q from 1 to the count of the task_titles
		if this_task is (item q of the task_titles) then
			if i is 1 then
				--adding the date so that different runs can be compared
				set the command_string to "date >> ~/Desktop/Maintenance_Results;" & (item q of the code_list)
				set the command_string to command_string & ";" & (item q of the code_list)
			end if
		end if
	end repeat
end repeat

--Perform Maintenance in the Background
set DIALOG00 to "Automatically Restart or Shut down? You will lose any unsaved data"
display dialog DIALOG00 buttons {"Restart", "Shut Down", "Later"} default button 3 with icon 0
set the button_pressed to the button returned of the result
if the button_pressed is "Later" then
	set TASK00 to "echo \"Maintenance Complete\" >> ~/Desktop/Maintenance_Results"
	display dialog "Maintenance Complete" buttons {"OK", "Check Log"} default button 1 with icon 1
	if the button returned of the result is "OK" then
		-- action for 1st button goes here
		-- action for 2nd button goes here
		do shell script "open ~/Desktop/Maintenance_Results"
	end if
	if the button_pressed is "Shut Down" then
		set TASK00 to "echo \"Maintenance Complete\" >> ~/Desktop/Maintenance_Results"
		tell application "Finder" to shut down
		set TASK00 to "echo \"Maintenance Complete\" >> ~/Desktop/Maintenance_Results"
		tell application "Finder" to restart
	end if
end if
set the command_string to command_string & ";" & TASK00
do shell script command_string with administrator privileges

Now please…dont make fun of me too much, I havent been coding as much as I wish, and I am sure this code is uber sloppy and all…


I am trying to combined Ben’s great Progress bar into Maintenance so it will show the progress of the code…

Any help would rock…and again I am sorry if this is in the wrong section or if I am being a total tool and this cant be done. Thanks!

Model: Mac Mini Intel Core Solo, iBook G3
Browser: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv: Gecko/20070223 Camino/1.1b
Operating System: Mac OS X (10.4)