Inline expressions

Post your questions and help other users.

Moderator: Martin

Post Reply
Mar
Posts: 49
Joined: 20 May 2015 23:24
Location: Germany

Inline expressions

Post by Mar » 21 Mar 2016 13:05

Is it true that inline expressions only work with "{blabla}" and not with '{blabla}'?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Inline expressions

Post by Martin » 22 Mar 2016 13:13

Hi,

Yes, that's true. You can find the documentation in the help of action Script in section Inline Expressions:
[...] Inline expressions in strings with single quotes are not interpreted. This can be helpful for regular expressions, where a quantifier like {2} in the pattern ([0-9]){2}.* should not be replaced with 2.
Regards,
Martin

Mar
Posts: 49
Joined: 20 May 2015 23:24
Location: Germany

Re: Inline expressions

Post by Mar » 22 Mar 2016 13:38

Okay. The problem is that I'm using the action Plugin and I wanted to replace a configuration with a script which is located in putString with "". That's why I can only use ''.
I would like to avoid to place the action Script in front of Plugin.
But this isn't possible, isn't it?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Inline expressions

Post by Martin » 24 Mar 2016 20:52

Could you explain the problem in more detail? I don't fully understand how you would like to modify the configuration of the plugin.

Mar
Posts: 49
Joined: 20 May 2015 23:24
Location: Germany

Re: Inline expressions

Post by Mar » 26 Mar 2016 00:13

I'm setting up a guide that tells me which episode of a series I have to watch next.
Therefore I'm using this plugin
https://play.google.com/store/apps/deta ... signplugin
It's a nice plugin which I would really appreciate to everybody. As well this one
https://play.google.com/store/apps/deta ... ceneplugin
The developer is very nice. Try them.
The code I'm trying to insert is:

Code: Select all

list=newList();
for(element in getMapKeys(getMapValue(global_widget,'Serien')))
{
folge=getMapValue(getMapValue(global_widget,'Serien'),element);
string='Staffel {getElement(folge,0)} Folge {getElement(folge,1)}';
addElement(list,string);
}
s='{list,listformat,comma}'
I'll ask another thing regarding these plugins later on.

Code: Select all

putString("com.yourcompany.yourapp.extra.STRING_ITEMS", "{list=newList();
for(element in getMapKeys(getMapValue(global_widget,'Serien')))
{
folge=getMapValue(getMapValue(global_widget,'Serien'),element);
string='Staffel {getElement(folge,0)} Folge {getElement(folge,1)}';
addElement(list,string);
}
s='{list,listformat,comma}'}");
Thanks a lot.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Inline expressions

Post by Martin » 26 Mar 2016 19:30

Would it be possible to build the comma separated list first and then pass it to the plugin?

Something like this:

Code: Select all

list=newList();
for(element in getMapKeys(getMapValue(global_widget,'Serien')))
{
   folge=getMapValue(getMapValue(global_widget,'Serien'),element);
   string="Staffel {getElement(folge,0)} Folge {getElement(folge,1)}";
   addElement(list,string);
}
s="{list,listformat,comma}";

putString("com.yourcompany.yourapp.extra.STRING_ITEMS", s);

Mar
Posts: 49
Joined: 20 May 2015 23:24
Location: Germany

Re: Inline expressions

Post by Mar » 04 Apr 2016 23:45

Okay. After an technical bug caused by the plugin it's working well. I have placed the script inside the plugin action in front of putString()
Thanks

Post Reply