Script maker tool
I was planning to add a video…but I decided to not do it (you have a preview some post ago)
This tool is a script that makes scripts. You don’t need to know programming, and also this will provide you personal examples if you want to learn. The sub-scripts are Lightning shortcuts that can be done from scripting. (Please: note that long scripts can be less efficient)
The instructions are very simple:
– Copy this script and check the ‘appear in’ ‘item menu’ and ‘lightning menu’
– Run this script from where you want. If you do it from a shortcut or folder, launch/open. sub-scripts will also be available.
– Write the letters you want. One after another, for example ‘h1b’
– Copy the output script and run it whenever you want. It will do what you choosed.
Available sub-scripts are:
1,2,3…- X seconds pause
b- Desktop Bookmark: Go to this container position
z- Zoom 100p
l- Full scale
t- Toogle zoom full scale/100p
h- Go to home desktop
n- Next desktop
p- Previous Desktop
u- Unlock screen
c- Close Top-most folder
a- Close all folders
f- Open this folder (if available)
s- Launch this shortcut (if available)
Feel free to comment and suggest others sub-scripts.
(If google+ syntax broke it let me know.)
———————————–
//Vars
var e = LL.getEvent();
var c = e.getContainer();
var it = e.getItem();
//Input
var folshor = 0;
if(c.getId()==-1)c=LL.getCurrentDesktop();
if(it!=null)if(it.getType()==”Folder”){folshor=1;}else if(it.getType()==”Shortcut”)folshor=2;
var input = LL.getScriptTag() || “”;
var info = “Write the secuence in order, for example ‘u1hz’ :\n\
1,2,3…- X seconds pause\n\
b- Desktop Bookmark: Go to this container position\n\
z- Zoom 100p\n\
l- Full scale\n\
t- Toogle zoom full scale/100p\n\
h- Go to home desktop\n\
n- Next desktop\n\
p- Previous Desktop\n\
u- Unlock screen\n\
c- Close Top-most folder\n\
a- Close all folders\n”;
info+=”\n”;
if(folshor==1)info+=”f- Open this folder\n”;
if(folshor==2)info+=”s- Launch this shortcut\n”;
var list = prompt(info,input);
if (list==null)return;
LL.setScriptTag(list);
//maker
var scriptbeg=””;
var scriptend=”\n\/\/Made with TrianguloY’s script maker tool”;
var indent=””;
for(var i=0;i var code = list[i]; if(code==” “||code==”\n”)continue; scriptbeg+=indent; if(code>=’1′ && code<='9'){ var n=parseInt(code); scriptbeg+=”setTimeout(function(){\/\/ Launch after…”; scriptend=indent+”},”+n+”000);\/\/…”+n+” second”+(n==1?””:”s”)+”\n”+scriptend; indent+=” “; }else switch(code){ //case ‘0’: case ‘b’: scriptbeg+=”LL.getContainerById(“+c.getId()+”).setPosition(“+c.getPositionX()+”,”+c.getPositionY()+”,”+c.getPositionScale()+”,true);\/\/Desktop Bookmark”; break; case ‘z’: scriptbeg+=”c.setPosition(0,0,1,true);\/\/Zoom 100p”; break; case ‘l’: scriptbeg+=fullScaleText(false); break; case ‘t’: scriptbeg+=fullScaleText(true); break; case ‘h’: scriptbeg+=”LL.goToDesktop(LL.getHomeDesktop().getId());\/\/Go to home desktop”; break; case ‘n’: scriptbeg+=npdesktop(“+”); break; case ‘p’: scriptbeg+=npdesktop(“-“); break; case ‘u’: scriptbeg+=”LL.unlock();\/\/Unlock”; break; case ‘f’: if(folshor==1)scriptbeg+=”LL.getItemById(“+it.getId()+”).open();\/\/Open folder”; break; case ‘s’: if(folshor==2)scriptbeg+=”LL.getItemById(“+it.getId()+”).launch();\/\/Launch item”; break; case ‘c’: scriptbeg+=”var f=LL.getOpenFolders().getAt(0); if(f)f.close();\/\/Close topmost folder”; break; case ‘a’: scriptbeg+=”var fl=LL.getOpenFolders(),fll=fl.getLength(); if(fll>0)for(var i=0;i break; default:scriptbeg+=”\/\/Order not found “+code; } scriptbeg+=”\n”; } prompt(“Here is your script :3 Just copy/paste and run”,scriptbeg+scriptend); /*NOTES: The getCurrentDesktop() is in every subscript because it can change */ //Vars, functions function npdesktop(sig){ var str = “var c = LL.getCurrentDesktop(),l=LL.getAllDesktops(),i;”; str+=”\/\/Go to ” + (sig==”+”?”next”:”previous”)+” desktop\n”; str+=indent+” for(i=0;i if(sig==”+”){ str+=indent+” if(i==l.getLength()-1)i=-1;\n”; }else{ str+=indent+” if(i==0)i=l.getLength()-2;\n”; } str+=indent+” LL.goToDesktop(l.getAt(i”+sig+”1));”; return str; } function fullScaleText(tog){ var str = “var c = LL.getEvent().getContainer()||LL.getCurrentDesktop();”; str+=”\/\/”+(tog?”Toogle zoom full scale/100p”:”Zoom full scale”)+”\n”; if(tog)str+=indent+”if(c.getPositionX()==0&&c.getPositionY()==0&&c.getPositionScale()==1){\n”; var ind=tog?” “:” “; str+=indent+ind+”var box = c.getBoundingBox();\n” str+=indent+ind+”var layout = [box.getRight()-box.getLeft(),box.getBottom()-box.getTop()];\n” str+=indent+ind+”var scale = Math.min(c.getWidth()/layout[0],c.getHeight()/layout[1]);\n” str+=indent+ind+”var pos = [ box.getLeft()- (c.getWidth()/scale-layout[0])/2 , box.getTop()-(c.getHeight()/scale-layout[1])/2 ];\n”; str+=indent+ind+”c.setPosition(pos[0],pos[1],scale,true);” if(tog)str+=”\n”+indent+”}else c.setPosition(0,0,1,true);”; return str; }
< ![CDATA[
TrianguloY I tried the G+ ‘copy text’, but copying stopped at line: var input = LL.getScrip…
Is there another way or tool to copy your whole script? Thanks in advance for your answer.
]]>
< ![CDATA[
Larry Kar hmm, I tried it and it works for me. I’m using the mobile app.
Anyway here you have
http://pastebin.com/z7098veA
]]>
< ![CDATA[
TrianguloY Got it, thanks! But I’ve the same problem with any post: copy cut before the end using mobile app too. Didn’t find why at the moment 🙁
]]>
< ![CDATA[
Best Script Ive tried out of five or six so far over the last few days… very cool work +TrianguloY – many thanks!
]]>
< ![CDATA[
Is it possible to update this script to add an option to toggle the notification bar? I have the notification bar hidden & I’m trying to create a shortcut to briefly show it then hide it again.
]]>
< ![CDATA[
With script it is not possible.
However you can make it placing a shortcut to the LL toggle notification bar, launch the script maker from that shortcut and use launch-wait-launch
]]>
< ![CDATA[
TrianguloY that’s what I did & it works fine. I was just hoping there was a way to do it with a swipe gesture. Thanks for the script anyway. I took a Web design class but for some reason I never got Javascript.
]]>
< ![CDATA[
Once you have the script you can execute it from where you want, for example from a swipe (even from a different desktop, but preferably not). Just don’t delete the shortcut, you can hide it.
]]>
< ![CDATA[
I didn’t realize it would work that way but it does. Thanks.
]]>
< ![CDATA[
Getting unterminated string at line 26?
]]>
< ![CDATA[
Be sure to copy the script with all correct line breaks and characters.
If you are from a computer instead of copy it manually use the ‘copy text’ feature, the same as from the app.
(Specially the ones in and before line 26)
]]>