binding a radio group

So I went through the article about preferences that is stickied. I’m still a little confused however. So in my preferences window there is a radio group with 2 options. I binded the radio group like it says in the article. Now for the applescript. Now assuming my code looks something like this:

on will finish launching theObject
   try
       tell user defaults
          make new default entry at end of default entries with properties {name:"launchMode", content:???}
       end tell
   end try
end will finish launching

I don’t know what to put for content for a radio group (hence the “???” in my code :P) What I want to do is save whatever is selected in the prefs window and upon relaunch open a certain window depending on what radio button is selected. So I guess my read would be something like this?

  tell user defaults
       set launch_mode to content of default entry "launchMode"
 end tell

and then would i just do an if statement to check the value of launch_mode? Defaults confuse me :confused:

I would bind the Selected Index and then use an if statement to handle the possible values.

this is my code:

on will finish launching theObject
	tell window "prefs"
		set launchchoice to current row of matrix "launch_choice" of box "launch_box"
		
	end tell
if launchchoice = 1 then
			hide window "hud1"
			show window "main"
		else if launchchoice = 2 then
			hide window "main"
			show window "hud1"
		end if
	try
		tell user defaults
			make new default entry at end of default entries with properties {name:"launchMode", content:launch_choice}
		end tell
	end try
end will finish launching

When fullmode is turned on it works perfectly but when search mode is turned on the main window won’t hide

It would start at 0 and increase from there.

It probably doesn’t exist yet.

awake from nib

I would try having nothing visible at launch, and then use the launched event to check the user defaults and display the appropriate window.

That did it! Thanks :smiley: