Hi, I was wondering how to make a link placeholder via a script?
Hi, I was wondering how to make a link placeholder via a script? The idea is that when you click on that particular placeholder it opens that link, then when you long tap it you can change the link to a new one. Thanks!
]]>
« Hi (Previous Post)
< ![CDATA[
Try this:
Set this script in the long tap event of an item. Leave the tap as default.
var item=LL.getEvent().getItem();
var link=prompt(“Write a link:”,item.getIntent().getData());
if(link==null) return;
item.setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(link)));
item.setLabel(link);
]]>
< ![CDATA[
Thanks TrianguloY! Tried it and was able to change the link. When I click on the new link however, it does not proceed to Chrome. Instead there is a pop-up saying “Item is not installed. Proceed to Google Play or pick another app?”
]]>
< ![CDATA[
But does it open another app? Or simply nothing happens?
Make sure the tap event is ‘unset’
]]>
< ![CDATA[
There is a pop-up saying “Item is not installed. Proceed to Google Play or pick another app?” The tap event is unset.
]]>
< ![CDATA[
Hmm, does it happens with all links?
Try with
http://www.google.com
]]>
< ![CDATA[
It worked! Thanks TrianguloY! Didn’t realize I had to input the whole link as I was only putting “http://www.google.com“
]]>
< ![CDATA[
Tweaked it a little bit to also prompt for a new label:
var item=LL.getEvent().getItem();
var link=prompt(“Write a link:”,item.getIntent().getData());
if(link==null) return;
item.setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(link)));
var label=prompt(“Write a label:”,item.getIntent().getData());
item.setLabel(label);
After you click it once to load the link however, the label doesn’t stick although the link seems fine.
]]>
< ![CDATA[
Nice! It’s good that you take that script as a base to create your own personal script.
For the label use item.setLabel(label,true); to make it persistent.
]]>
< ![CDATA[
Thanks again TrianguloY! Tried again and it worked.
P.S.
Change the link first, don’t leave it as it is, even if it was already the link you want to input, or else the label won’t persist. Happened to me the first few attempts hahaha
]]>
< ![CDATA[
Nice Idea this
]]>