User Tools

Site Tools


script_visual_folder

====== About the script ====== * Purpose : This script will automatically detect the position of an item (detached or not) relatively from the actual screen, and then apply it to a folder. * Author : [[https://plus.google.com/u/1/105066926163073195690|TrianguloY]] * Link: https://plus.google.com/u/1/105066926163073195690/posts/CE7MFMXbmKs (With video) ====== How to use the script ====== You need to run it from the long click menu. (It will detect if the item is a folder or not) The data is saved and applied once. Instructions: * Copy paste this script, check the 'show in item menu' * Place an item (not a folder) and change their size as you want, relative to the screen itself, not the desktop (you can be far away from the main page) * Run the script. The position/size will be saved. * Run the script in a folder. Apply. * (Now you can delete the previous item if you want.) ====== Script code ====== <sxh javascript> var item = LL.getEvent().getItem(); var desk = LL.getEvent().getContainer() || LL.getCurrentDesktop(); if(item.getType()=="Folder"){ if(!("visualFolder" in self)){alert("No data found\nYou need to run the script from a non-folder first to save data"); return;} if(!confirm("Folder detected. Would you like to apply the saved data?") )return; item.getProperties().edit(). setString("f.wAH","CUSTOM"). setString("f.wAV", "CUSTOM"). setInteger("f.wX", self.visualFolder[0] ). setInteger( "f.wY", self.visualFolder[1] ). setInteger( "f.wW", self.visualFolder[2] ). setInteger( "f.wH", self.visualFolder[3] ). commit(); Android.makeNewToast("Data applied",false).show(); }else{ self.visualFolder=[]; self.visualFolder[0] = item.getPositionX()-desk.getPositionX(); self.visualFolder[1] = item.getPositionY()-desk.getPositionY(); self.visualFolder[2] = item.getWidth()*item.getScaleX(); self.visualFolder[3] = item.getHeight()*item.getScaleY(); Android.makeNewToast("Saved data. Run the script on a folder to apply",false).show(); } </sxh>

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