Safari tweaking app

All right Im making a Apple Script app that will make it to where your able to edit the safari 4 UI. Right now it looks like:


--Just getting it started
display dialog "Please quit Safari"
tell application "Safari" to (quit)
-- Pick from list
choose from list {"Change the tabs", "Change the loading bar", "Change URL autocompleate", "Disable Top Sites"} with prompt "Choose one of the following things you would like to change in Apple's Safari 4 Beta" default items {"Change the tabs"} OK button name "Choose"
--Define vars
set normalTabs to {"Change the tabs"}
set changeLoadingBar to {"Chage the loading bar"}
--DebugSafari4TabBarIsOnTop moves the tab bar back where you expect it to be
do shell script "defaults write com.apple.Safari DebugSafari4TabBarIsOnTop -bool NO " & normalTabs
--We tell the Application Safari to quit then reopen
display dialog "Thanks!"
tell application "Safari" to launch

But when ever the script gets to the

do shell script "defaults write com.apple.Safari DebugSafari4TabBarIsOnTop -bool NO " & normalTabs

it returns:

Im fairly new to all this and I’m really lost when that error comes up.
Thanks,
Robert

Hi,

defaults write . -bool requires only one parameter (NO or YES), the additional parameter normalTabs causes the error

Okay so how would I “hook it up to the list”?

do shell script "defaults write com.apple.Safari DebugSafari4TabBarIsOnTop -bool NO " & {"Change the tabs"}

I tried that and it caused the error.

as mentioned above, the -bool parameter is either YES or NO, the correct syntax is


do shell script "defaults write com.apple.Safari DebugSafari4TabBarIsOnTop -bool NO"

you can’t append any list (or whatever) at all to a boolean value.

Hmm the only other way i can think of doing this is just do it in order?

What are you going to accomplish?

DebugSafari4TabBarIsOnTop enables or disables the tabs on top, nothing else

I wanna be able to have the user choose what option to change if you havnt noticed the list.

You need something like this


--Just getting it started
display dialog "Please quit Safari"
-- Pick from list
set func to choose from list {"Change the tabs", "Change the loading bar", "Change URL autocompleate", "Disable Top Sites"} with prompt "Choose one of the following things you would like to change in Apple's Safari 4 Beta" default items {"Change the tabs"} OK button name "Choose"
--Define vars
if func is false then return
set func to item 1 of func
quit application "Safari"
if func is "Change the tabs" then
	try
		set flag to (do shell script "defaults read com.apple.Safari DebugSafari4TabBarIsOnTop") as boolean
	on error
		set flag to true
	end try
	set flag to not flag
	set flagText to item ((flag as integer) + 1) of {"NO", "YES"}
	do shell script "defaults write com.apple.Safari DebugSafari4TabBarIsOnTop -bool " & flagText
end if
--We tell the Application Safari to quit then reopen
display dialog "Thanks!"
activate application "Safari"