I would really love to see dynamic text set by a script
I know I can edit a label, but that’s only a workaround
« Today it exists the LL-Action “open folder” where you specify the named folder, but there’s no action to close a… (Previous Post)
(Next Post) v9.9.16 beta »
< ![CDATA[
Something like an ‘always on’ timer.
This will be extremely powerful, but a bit dangerous if the executed script is long/heavy…anyway this is something users need to know.
]]>
< ![CDATA[
The most important thing is when the script is executed. All scripts must be executed through an event, or possibly a timer, which has previously been set because of an event (either a user one or a generated one like load).
Do you mean a dynamic text whose value will be evaluated on a regular basis ?
]]>
< ![CDATA[
Sorry, I don’t really understand your last sentence
]]>
< ![CDATA[
This might well be because I didn’t understood your request 😉
Why setting the label is only a workaround ? It is not so bad after all ?
]]>
< ![CDATA[
I want a text which always shows the value of a variable in a script…
Maybe you are right, I just use labels.
It’s just the principle of using a shortcut to display text.
]]>
< ![CDATA[
But a problem with this is: item.getLabel() returns the default, not the current label.
]]>
< ![CDATA[
Ok, but the issue is to know when to update the text with the value of the variable. And this can only be done because of some event. It is not possible to detect that a JavaScript variable has been updated somewhere else
]]>
< ![CDATA[
Maybe except if it has been set with the persistent parameter to true (I didn’t checked this but I think it should behave this way)
]]>
< ![CDATA[
I would like dynamic text to include the stock email app. I’m on GS4 4.4.2 AT&T.
]]>
< ![CDATA[
Pierre Hébert I think the feature wouldn’t be bad to have, but is at any rate not important.
]]>
< ![CDATA[
Silvia Rivera I am sorry but this is really not possible 🙁
]]>
< ![CDATA[
What is the default value of a tag?
“” or null or sth other?
]]>
< ![CDATA[
This is null
]]>
< ![CDATA[
Ok. And what returns JSON.parse(null) ?
]]>
< ![CDATA[
Maybe it raises an exception, I don’t know. Have you something in mind?
]]>
< ![CDATA[
var d=LL.getEvent().getContainer();
if(d.getId()==-1)d=LL.getCurrentDesktop();
if(d.getPositionScale()!=1)return;
var data=JSON.parse(d.getTag());
if (data==null || data.state==null)
{
data=new Object();
data.state=0;
data.running=false;
}
if(data.running==true)return;
data.running=true;
d.setTag(JSON.stringify(data));
[code]
data.running=false;
d.setTag(JSON.stringify(data));
A script, which allows only one execution per container and stores some other values in tag.
]]>
< ![CDATA[
It does not work without the data.state==null.
I wanted to know why.
]]>
< ![CDATA[
Use this:
d.getTag()||””
]]>
< ![CDATA[
Syntax Error: empty JSON string
]]>
< ![CDATA[
Correct is : d.getTag()||”null”
]]>
< ![CDATA[
Oh, yes. Sorry
]]>