Can anyone help me with “runScript” and “getData”? There seems to be a problem with passing the parameter…

Can anyone help me with “runScript” and “getData”? There seems to be a problem with passing the parameter…

script1:

LL.runScript(“script2″,”myPanel”);

script2:

var d = LL.getCurrentDesktop();

var e = LL.getEvent();

var p = e.getData();

alert(p);

var i = d.getItemByLabel(p);

I have a panel labeled “myPanel” on the desktop.

I run script1 from a shortcut.

Alert shows ‘myPanel’.

getItemByLabel returns NULL.

BUT: if I directly use d.getItemByLabel(“myPanel”), the panel is found.

Is this a bug?

]]>

13 Commentsto Can anyone help me with “runScript” and “getData”? There seems to be a problem with passing the parameter…

  1. Anonymous says:

    < ![CDATA[

    alert(d.getItemByLabel(“myPanel”).getLabel()) shows myPanel without the single quotes BTW.



    Do I need to use JSON to pass a single string?

    ]]>

  2. Anonymous says:

    < ![CDATA[

    The quotes are a part of the result getdata(). Wether it”s bug or a feature i dont”t know.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Yes, definitely a bug. alert (“-” + p + “-“) shows “-‘myPanel’-“. Quotation mark are part of the string. Tried replace(“‘”,””), removes only first mark.



    Great, my first try with scripting, failing at once 🙁

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Pierre Hébert Or am I doing something wrong? Is JSON-encoding required? Documentation states otherwise, JSON as option.

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Lutz Linke to be honest: I think it it’s really a bug. (Didn’t try myself, just from your comments)

    ]]>

  6. Anonymous says:

    < ![CDATA[

    I don’t remember why but the data is explicitly quoted and escaped. Testing without these extra quotes didn’t reveal any problem. Does anybody remember whether there was a need for this at time of introduction of this runScript function ?

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Pierre Hébert Searched the community, did not find anything. My bet would be JSON requires this quoting. Quick search showed samples like:


      var json = ‘{“result”:true,”count”:1}’,


      var obj = JSON.parse(json);


    Seems JSON requires double quotation marks inside a string in single quotation marks. I think you tried to ensure somehow a JSON string would be transfered correctly from calling to receiving function.

    ]]>

  8. Anonymous says:

    < ![CDATA[

    But tag also lets you store json…and it don’t add the quotes :/

    ]]>

  9. Anonymous says:

    < ![CDATA[

    TrianguloY Thanks. Tag however does not seen appropriate to post data.


    Anyway… I tested my theory, tried JSON stringify and parse, but even JSON complains “unexpected token ‘ ” (not sure I used JSON properly, new to me). So the single quotes do not make sense.


    Or, Pierre Hébert , did you find a reason why the escaping was added?

    ]]>

  10. Anonymous says:

    < ![CDATA[

    Lutz Linke The single quotes in your example are just ‘second double quotes’


    I mean:


    ‘This a string that have a “string” inside’


    So, if you want to make a string with ‘strings’ inside you can use (and you need to use in other languages)


    “This a string that have a \”string\” inside”


    But, in JavaScript, quotes are more or less the same, so you can use the others.


    In theory (but I didn’t test) you can also write


      var json = “{‘result’:true,’count’:1}”,


      var obj = JSON.parse(json);

    ]]>

  11. Anonymous says:

    < ![CDATA[

    To sum up


    Pierre: remove the extra quotes

    ]]>

  12. Anonymous says:

    < ![CDATA[

    TrianguloY Yes, I knew that with JS one can use both single or double quotes. Tried to figure out a possible use.



    Second your opinion: extra quotes (and escaping if any) must be removed. Data must not be altered. It’s just a string anyway.

    ]]>

  13. Anonymous says:

    < ![CDATA[

    I finally found the reason for this escaping. It was required with the older script engine, but I forgot about this at time the second engine replaced the first one.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *