User Tools

Site Tools


script_find_items

====== About the script ====== * Purpose : See below * Author : [[https://plus.google.com/u/1/105066926163073195690|TrianguloY]] * Link: https://plus.google.com/u/1/105066926163073195690/posts/ED4Saf7Sxws ====== How to use the script ====== This script will go through all the items in the container were it was launched. It will show basic info about it, and the item will be in the topleft corner. ( then a zoom out will shows you where it is) Also, the script automatically make the items with Alpha 255, the frontmost and will unpin it. To keep these modifications (in case the item was lost somewere) stop the script from the popup. If not, the original settings will go back. (to sum up: in the "continue?" popup, Yes->no changes; No->changes and stop) Instructions: Just copy\paste and run. ====== Script code ====== <sxh javascript> var desk=LL.getEvent().getContainer(); var px = desk.getPositionX(); var py = desk.getPositionY(); var ps = desk.getPositionScale(); var items=desk.getItems(); for(var i=items.getLength()-1;i>=0;--i){ var item = items.getAt(i); var data = []; data[0] = item.getProperties().getInteger("i.alpha"); data[1] = item.getProperties().getString("i.pinMode"); data[2] = desk.getItemZIndex( item.getId() ); desk.setItemZIndex(item.getId() , 100000); item.getProperties().edit(). setInteger( "i.alpha" , 255). setString("i.pinMode","NONE"). commit(); var zoom = Math.min( desk.getWidth() / item.getScaleX() / item.getWidth(), desk.getHeight() / item.getScaleY() / item.getHeight()); desk.setPosition( item.getPositionX() , item.getPositionY() , zoom,true ); var type = item.getType(); var info = "Item found:"; info+="\n-Type: "+ type; if(type=="Shortcut" || type=="Folder") info+="\n-Label: "+item.getLabel(); info+="\n-Id: "+item.getId(); info+="\n-Pin Mode: "+data[1]; info+="\n-Alpha: "+data[0]; info+="\n-Tag: "+item.getTag(); info+="\n-Visibility: "+item.isVisible(); info+="\n-Z Index: "+data[2]; alert(info); var n = 3;//zoom out desk.setPosition( item.getPositionX()-desk.getWidth()/zoom*(n-1)/2,item.getPositionY()-desk.getHeight()/zoom*(n-1)/2,zoom/n,true ); if( !confirm("Continue? (If not, Zindex,alpha and PinMode won't get back)") )return; desk.setItemZIndex(item.getId() , data[2]); item.getProperties().edit(). setInteger( "i.alpha" , data[0]). setString("i.pinMode", data[1]). commit(); } desk.setPosition(px,py,ps,true); Android.makeNewToast("no more items found",false).show(); </sxh>

script_find_items.txt · Last modified: 2014/07/22 14:46 by trianguloy