User Tools

Site Tools


automatic_parameters

Automatic Parameters

This example shows how to automatic set the MinMax range of parameters. The SOLOIST knows the commands CUESPOT and PLAYSPOT, both need the name of the spot (clip) as parameter. It is of course possible to proceed in the same way than e.g. with the SetName command, and implement a text field that contains the clip name. But the SOLOIST also knows the command INVENTORY, which returns a list of all available clips on the machine. This leads to a more comfortable way to select a clip. We use the INVENTORY command to get all available clips, and then we put this list in the MinMax definition of the CUESPOT and PLAYSPOT command. This presents the end user a picklist, and there is no need to type the clip names (and make mistakes).

To start with the example we create the CUESPOT command as shown below:

The script is only one line: ScriptResult = DP1 + “ CUESPOT ” + “”“” + P1 + “”“” + Chr(13). Respecting the SOLOIST protocol, the spot name has to be in quotation marks. The four quotation marks (“”“”) before and after P1 do this job. P1 GUI is a Drop Down list that contains a list of available clips. But at this time we don't know how many clips are present on the SOLOIST player, so it stays empty. Then we create the command PLAYSPOT in the same way ScriptResult = DP1 + “ PLAYSPOT ” + “”“” + P1 + “”“” + Chr(13). Now we have two new commands, but until now they are not useful because we cant select a clip name as parameter.

To get all available clips we create the command “GetInventory”. His job is to retrieve the clip list and fill the MinMax definition of PlaySpot and CueSpot commands. The GetInventory command is described in the screenshot below.

The GetInventory command does not fill the MinMax definitions. The command only tells the SOLOIST that the inventory list is requested. To read the list and fill the MinMax definitions, we use an acknowledge command, in this case ACK_GetInventory.

The script is quite complex, so here some explanations:

Dim i As Integer
Dim tmp, res As String

res = ""
For i = 1 To CountFields(IOResult,Chr(13))
   //Dont use the first row And last two Rows
   If (i > 1) And (i < CountFields(IOResult,Chr(13)) - 1) Then
      tmp = NthField(IOResult,Chr(13),i)
      //Delete first character because it's trash
      tmp = Mid(tmp,2)
      res = res + NthField(tmp," ",1) + ";"
  End
Next

//Delete last ";"
res = Left(res,Len(res)-1)
//Replace current MinMax Value with res
ChangeCMD_MinMax("CueSpot","P1",res)
ChangeCMD_MinMax("PlaySpot","P1",res)
ShowMessage("Parameter for CueSpot and PlaySpot set to:" + Chr(13) + res)

Line 1 declares i as Integer variable. It is used in the For .. Next loop as counter. Tmp is used as temporary variable and res is used to hold the new MinMax list. The function CountFields(IOResult,Chr(13) tells how many lines (every line is terminated by chr(13)) in IOResult. The For .. Next loop is processed as many times, as chr(13) codes present in IOResult. The first line and the two last lines of IOResult don't contain any valid information, that's why the If .. Then statement present. The statement tmp = NthField(IOResult,Chr(13),i) assigns content of the i'st line to tmp. Then the content of tmp is added to res, followd by a semicolon.

At last we have to change the GetInventory command an tell it to use the acknowledge command.

Set Ack Cmd to “ACK_GetInventory” (Update Cmd and Compile)

automatic_parameters.txt · Last modified: 2013/08/19 11:58 by admin