Set Audio.talk
_______________________________________________________

// Set Audio, 
// (c) Oscar 2004
// this creates a menu for selecting audio track
// the menu shows an arrow on currently selected audio
// we use switched menu for this trick.

sText1 = "Audio Track 1"
sText2 = "Audio Track 2"
sText3 = "Audio Track 3"
sText4 = "Audio Track 4"

input "Menu for setting audio","What do you want to call the audio tracks in the menu?","Audio 1",sText1,"Audio 2",sText2,"Audio 3",sText3,"Audio 4",sText4,"","Set empty text for non-existing tracks."

// terminate script if pressed cancel
if bCancelInput then
   end
endif

// first is component then menus
menu[1] = menusInBlackBox[2]
menu[2] = menusInBlackBox[3]
menu[3] = menusInBlackBox[4]
menu[4] = menusInBlackBox[5]

// now remember objects in the menu[1]
// get the object from its label, a simple and effective way
// label is not case sensitive
objText1 = ObjectGetFromLabel(menu[1],"text1")
objText2 = ObjectGetFromLabel(menu[1],"text2")
objText3 = ObjectGetFromLabel(menu[1],"text3")
objText4 = ObjectGetFromLabel(menu[1],"text4")

objArow = ObjectGetFromLabel(menu[1],"arrow")
ArrowX = ObjectGetXPos(menu[1],objArow)
ArrowY = ObjectGetYPos(menu[1],objArow)


objBack = ObjectGetFromLabel(menu[1],"back")

// since we will copy the menus from first, these object will be valid for every menu.
// link the back button to VTS root (1)
ObjectLinkToMenu(menu[1],objBack,1)

MenuCopy(menu[1], menu[2])
MenuCopy(menu[1], menu[3])
MenuCopy(menu[1], menu[4])

// now set vm command for each menu
MenuRemovePRECommands(menu[1])
MenuRemovePRECommands(menu[2])
MenuRemovePRECommands(menu[3])
MenuRemovePRECommands(menu[4])

MenuAddPRECommand(menu[1], "SetSTN (audio=0 )")
MenuAddPRECommand(menu[2], "SetSTN (audio=1 )")
MenuAddPRECommand(menu[3], "SetSTN (audio=2 )")
MenuAddPRECommand(menu[4], "SetSTN (audio=3 )")

// now set text and links on each menu
for n=1 to 4
   
   // on each menu the next button will be selected by default
   
   MenuSetPBC(menu[n],255,n,0)
   
   ObjectSetText(menu[n],objText1,sText1)
   ObjectSetText(menu[n],objText2,sText2)
   ObjectSetText(menu[n],objText3,sText3)
   ObjectSetText(menu[n],objText4,sText4)

   
   ObjectLinkToMenu(menu[n],objText1,menu[1])   
   ObjectLinkToMenu(menu[n],objText2,menu[2])      
   ObjectLinkToMenu(menu[n],objText3,menu[3])   
   ObjectLinkToMenu(menu[n],objText4,menu[4])
   
// set arrow position
   ObjectSetPos(menu[n],objArow,ArrowX,ArrowY)
   // move arrow to next text
   ArrowY = ArrowY + 45
next n

// delete objects and menus that are nonfunctional

if (sText4=="") then
   ObjectDelete(menu[1],objText4)
   ObjectDelete(menu[2],objText4)
   ObjectDelete(menu[3],objText4)

   MenuDelete(menu[4])

   // check track 3
   if (sText3=="") then
      ObjectDelete(menu[1],objText3)
      ObjectDelete(menu[2],objText3)
      MenuDelete(menu[3])
   endif
   
endif





Created with DVD-lab Pro