Facility Control

 View Only
  • 1.  Convert Value in string

    Posted 03-08-2017 20:13

    Hi;

    I work actually on a Custum pannel to send tcp message string. I have a parameter with value and name. But in visual logic when I want to use the selection it is the value and not the name. Is it possible to use the name or ton convert value in string ?

    Is it possible to use that with an XML ? At the end I would like to use that with 100 value to recall a specific string. It is easyer to add 100 value in an XML than type one by one



  • 2.  RE: Convert Value in string

    Posted 03-08-2017 20:48
    Unfortunately, Visual Logic only currently supports getting the parameter value and not getting the value as a String.

    Your best option is to replace your current Visual Logic code with this line of ogScript:

    rosstalk.sendMessage(params.getValue('IP_CCG_SERVEUR', 0), 7070, ("PLAY 1-10 " + params.getValueAsString('Videos', 0)), null);
    #DashBoard


  • 3.  RE: Convert Value in string

    Posted 03-08-2017 21:03
    Hi James;
    Thanks for your Help. I would like to go further and add my transition and transition duration. Could you have a look on my code. It is the beginning for me and not easy.

    rosstalk.sendMessage(params.getValue('IP_CCG_SERVEUR', 0), 5250, ("PLAY 1-10 " + params.getValueAsString('Videos', 0) +' MIX' + params.getValue('Transition_Duration', 0));
    ), null);

    #DashBoard


  • 4.  RE: Convert Value in string

    Posted 03-08-2017 21:19

    I'm not sure what protocol your server is talking but I would guess that you likely need to add a space after the word MIX (so +' MIX' + becomes +' MIX ' +)

    You may want to create a variable that builds your message and then send it. This will give you the ability to write the message to the debug view before you send it (so you can see what you are sending):

    var host = params.getValue('IP_CCG_SERVEUR', 0);
    var port = 5250;
    var message = 'PLAY 1-10 ' + params.getValueAsString('Videos', 0) +' MIX ' + params.getValue('Transition_Duration', 0);
    
    rosstalk.sendMessage(host, port, message, null);

    #DashBoard


  • 5.  RE: Convert Value in string

    Posted 03-08-2017 21:21
    Ok it work for me. I have an other question.

    Is it possible to do a "IF" with value ? I would like to add a check box to add (or not) a parametre in my tcp command. How can I do that ?

    IF checked, add 'LOOP' IF NOT, don't add.
    #DashBoard


  • 6.  RE: Convert Value in string

    Posted 03-08-2017 21:25

    Sure. Let's say you create a checkbox parameter called "loop" and you give it a value of 0 for "OFF" and 1 for "ON". This is how your code would change:

    var host = params.getValue('IP_CCG_SERVEUR', 0);
    var port = 5250;
    var loop = params.getValue('loop', 0);
    
    var message = 'PLAY 1-10 ' + params.getValueAsString('Videos', 0) +' MIX ' + params.getValue('Transition_Duration', 0);
    
    if (loop == 1)
    {
        message = message + ' LOOP';
    }
    
    rosstalk.sendMessage(host, port, message, null);

    #DashBoard


  • 7.  RE: Convert Value in string

    Posted 03-08-2017 21:40
    great Thanks. Is it an exaggeration to ask your help once again ?

    I would like to list files from a folder and have it on my custom pannel. I should be the 'VIDEOS' params

    #DashBoard


  • 8.  RE: Convert Value in string

    Posted 03-08-2017 21:50

    It doesn't work for the loop. Maybe my parameter loop is wrong


    #DashBoard


  • 9.  RE: Convert Value in string

    Posted 03-08-2017 22:01

    In the code I gave you, the OID was lower-case "loop". In yours, it is upper-case "LOOP".

    As for your last question (about listing the files in a directory), assuming you just want to list the files and not directories, you can use the following code (note, you would replace file:/c:/ with the full path to the directory you wish to list)

    var choices = [];
    var file = ogscript.getFile("file:/c:/");
    if (file != null)
    {
       var subFiles = file.listFiles();
       for (var i = 0; i < subFiles.length; i++)
       {
          if (!subFiles[i].isDirectory())
          {
             choices.push(subFiles[i].getName());
          }
       }
    }
    
    var constraint = params.createIntChoiceConstraint(choices);
    params.replaceConstraint('Videos', constraint);

    #DashBoard


  • 10.  RE: Convert Value in string

    Posted 03-16-2017 06:49
    Thanks you for your help.


    #DashBoard