TrianguloY
now browsing by tag
Bug report (it’s been a long time since my last one :P )
This bug is something I reported months ago, but wasn’t sure what the cause were, and I thought you fixed it. Anyway, now I know.
Bug: when a folder (as item) has their icon set to ‘grid’ or ‘stack’, the Z-index of the items inside the folder (as container) is automatically set from left to right, top to bottom any time you enter/exit edit mode.
Problems:
1) the ‘move forward backward’ feature is useless.
2) if a script (wheel of items, zoom scroll…) takes the list of items and modify the position of the items, it change every time you go into edit mode.
No-problems: I understand the reason is to let the folder icon render easily just taking the first items of the list.
Solutions:
1) fast fix user-side: change the icon to ‘icon’
2) don’t change the Z index automatically. This will make folder icons with ‘apparently’ random icons.
3) modify the ‘icon taking’ of the folder to check every time the top-most and so on
4) as usual, a new setting to enable/disable this
]]>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; }
Zoom scrolling
Zoom scrolling
(Updated from the old alpha version)
This script will place the items in an infinite looping row, so the camera movement is as smooth as possible. The items won’t overlap, you can click them.
Instructions:
– copy paste this script and set it at the position change event of a container (it will use all the items inside, so better a panel)
– the items will need to be not pinned and detached from the grid.
– Set the scrolling to free scroll.
It automatically adapts if a new item is added or removed. However you will need to scroll one loop to update.
Settings: change them as you want
– maxsize: the maximum size the items will have
– see: the number of items you will be able to see at once
———————————————-
/*Config */
var see = 5;// Distance between items
var maxsize = 3; //Max scale of the item
var desk = LL.getEvent().getContainer();
var v = desk.getHeight()/2;
var h = desk.getWidth()/2;
var pos = desk.getPositionX();
var items = desk.getItems();
var n = items.getLength();
var distance = 2*h/see;
for(var i=0;i var p = Math.floor(pos/distance-n/2 +1); var arg = (p+i)%n; while(arg<0)arg+=n; var item = items.getAt(arg); var size = pos-(p+i)*distance ; if(size<0)size=-size; size=maxsize-( size /h*maxsize ); if(size<0.1){ size =0.1; item.setPosition( h+(p+i)*distance ,v); item.setSize(distance/maxsize,desk.getHeight()/maxsize); } item.setScale(size,size); /*items.getAt(arg).setLabel(items.getAt(arg).getWidth() ); */ }
Preview of my next little project.
Preview of my next little project.
Don’t worry if you don’t understand what’s happening, I’ll publish it soon (when some minor bugs get resolved)
Quick explanation: make the script you want just selecting the subscripts. A fully ready-to-use script will be created. No programming skills needed (just copy/paste)
Important: I used my ‘fast run’ tool to run the script.
In the video the script is:
Go to home desktop
Wait one second
Zoom 100p
Wait one second
Go to desktop bookmark
Wait one second
Zoom 100p
Unlock screen
Edit: yes, I like to make scripts that make scripts…scriptception! :D
]]>Em….the LL.getOpenFolders is wrong I think.
The items in the array are strange ones. No id function, no close, no type…what are they?
]]>API suggestion:
Array LL.getOpenFolders()
So we won’t need to search all the folders in all the desktops and check all the folders to see if it is open or not.
Edit: if possible, the folders in the array could be sorted depending on which is above. (Yes, I’m thinking in closing the top most folder just taking the first element)
]]>Fast run
This script is a little tool for those who want to launch short (or long) scripts in an easy way, without need to write a new one, launch it, forget to delete it…
This script will let you write/paste a script and run it directly from the eval javascript feature.
Features:
– Automatically save the last executed script
– Custom predefined vars: e-event, c-container, i-item (of the event)
– custom function: Toast(string)
IMPORTANT!
Since it uses the eval function, you can’t use alert,prompt or confirm. That’s why I made the Toast one. (Timeouts work)
Any suggestion will be greatly appreciated 🙂
————————————-
/*Available vars */
var e = LL.getEvent();
var c = e.getContainer();
var i = e.getItem();
var text = LL.getScriptTag() || “”;
var out = prompt(“Functions: Toast(string);\nVars: e-event, c-container, i-item\n\nPrevious input: \n”+text+”\n_________________________________________________________”,text);
//Change this ‘line’ if you want
if(out!=null) {
LL.setScriptTag(out);
eval(out);
}
/*available functions */
function Toast(say){Android.makeNewToast(say,false).show();}
]]>Simple Horizontal and Vertical page loop Updated again
From Michael Plotke’s script (but fixed…sorry it was broken) I made this script to switch between the ‘sides’ of the container (very easy, feel free to improve it)
Instructions:
– Set it at the position changed event.
– Set the free scroll.
– Check the snap to pages! Otherwise you’ll get udesired results.
– IMPORTANT: try not to scroll while the animation is performing
– Comment any problem here.
——————————–
var e = LL.getEvent();
var c = e.getContainer();
var box = c.getBoundingBox();
if(c.getPositionScale()!=1)return;
var pos = [c.getPositionX(),c.getPositionY()];
var size = [c.getWidth(),c.getHeight()];
var limits = [ [box.getRight(),box.getLeft()],[box.getBottom(),box.getTop()] ];
var state = LL.getScriptTag() || “00”;
state=[state[0],state[1]];
var jump = [pos[0],pos[1]];
var glide = [pos[0],pos[1]];
for(var i=0;i<=1;++i){
if (pos[i] > limits[i][0]-size[i]/2 ) {
if(state[i]==”+”)return;
jump[i] = limits[i][1]-size[i]/2;
glide[i] = limits[i][1] ;
state[i] = “-“;
}else if (pos[i] < limits[i][1]-size[i]/2 ) {
if(state[i]==”-“)return;
jump[i] = limits[i][0]-size[i]/2 ;
glide[i] = limits[i][0]-size[i] ;
state[i]=”+”;
} else {
state[i] = “0”;
}
}
LL.setScriptTag(state[0]+state[1]);
if(state[0]!=”0″ || state[1]!=”0″){
c.setPosition( jump[0] , jump[1], 1, false);
c.setPosition(glide[0], glide[1], 1, true);
}
]]>About the size bug I posted in another post.
Steps: do them in order:
Take an item with ScaleX=1 (I tried with a newly created one)
Open the geometry menu, go to the scale section.
Set ScaleX to 1000 –> scale set to 1000
Set ScaleX to 1 –> scale set to 1
Set ScaleX to 1001 –> scale set to 1001
Set ScaleX to 1 –> scale stay in 1001
From my observations, the rule is:
When setting a new scale (from the menu or from script)
If the new scale is less that the previous divided by 1000, it is not applied.
Another example: set it to 1234
You can set it to 2, but not 1.
You can set it to 1.235 but not 1.234
Pierre Hébert…are you sure you didn’t make this?
Oh, it work in the stable and in the latest beta.
]]>Reset tool
Just a little script-tool when you are playing with items…and things go wrong.
This script will reset the selected values of all the items in the container.
Suggestions are welcomed.
Just run it from the lightning or the item menu.
———————————-
var cont = LL.getEvent().getContainer();
var items = cont.getItems();
var bools = [];
bools[0] = confirm(“Reset cell? (only grid items) [0,0]”);
bools[1] = confirm(“Reset position? (only free items) [0,0] “);
bools[2] = confirm(“Reset rotation? (only free items) [0]”);
bools[3] = confirm(“Reset scale? (only free items) [1,1]”);
bools[4] = confirm(“Reset skew? (only free items) [0,0]”);
bools[5] = confirm(“Reset size? (only free items) [cell size]”);
bools[6] = confirm(“Reset visibility? [true]”);
for(var i=0;i var t=items.getAt(i); if(bools[0])t.setCell(0,0,1,1); if(bools[1]) t.setPosition(0,0); if(bools[2]) t.setRotation(0); if(bools[3]) t.setScale(1,1); if(bools[4]) t.setSkew(0,0); if(bools[5]) t.setSize(cont.getCellWidth(),cont.getCellHeight() ); if(bools[6]) t.setVisibility(true); }
D5 Creation