Load script depending on combo box selection.

I am trying to load a script depending on the user’s combo box selection. The user first selects a dog from the combo box dogBreedList. The user then clicks one of ten buttons. Each button displays something different about the selected dog.
My AppDelegate is empty because I have a ton of scripts and I am saving App Delegate for something else. How do I load my husky.script in DogDetails.Applescript when Husky is the selection of my combo box? I just recently started to dive into AS and ASOC so please bear with me if the solution is a simple one or my code is inefficient. Thank you :slight_smile:


script AppDelegate
  property parent : class "NSObject"
  property theWindow : missing value
	
	on applicationWillFinishLaunching_(aNotification)
        
	end applicationWillFinishLaunching_

	on applicationShouldTerminate_(sender)
		return current application's NSTerminateNow
	end applicationShouldTerminate_

 
end script


script DogDetails
  property parent : class "NSObject"
property theWindow : missing value
  property dogBreedList: missing value --my combobox
  
  on detailsButton_(sender)
    set currentDog to (dogBreedList's stringValue) as string
    set dogPosition to dogBreedList's indexOfItemWithObjectValue_(currentDog)
    if dogPosition = 0 then
    --load husky.script and display alert my return value
    else if dogPosition = 1 then
    --load doberman.script
    else
      display alert "Make a selection."
    end if
  end detailsButton_
end script


to getHuskyInfo()
	tell application "Safari"
		activate
		delay 1
		if (count of windows) is 0 then
			make new document at front
		end if
		delay 1
		set URL of document 1 to "http://www.animalplanet.com/breed-selector/dog-breeds/working/siberian-husky.html"
		delay 1
		repeat
			if (do JavaScript "document.readyState" in document 1) is "complete" then exit repeat
			delay 1
		end repeat
		set dogInfo to do JavaScript "document.getElementsByClassName('" & "details" & "')[0].innerHTML;" in document 1
	end tell
	return dogInfo --pass this to button action
end getHuskyInfo

In this case you probably want to use load script.