now browsing by category

 

I do not know why…just learn #LL scripts

I do not know why…just learn #LL scripts

LL.bindClass(‘java.lang.Runtime’);

LL.bindClass(‘java.io.DataInputStream’);

LL.bindClass(‘java.io.DataOutputStream’);

LL.bindClass(‘java.lang.StringBuffer’);

function runAsRoot(cmd){

try{

var process = Runtime.getRuntime().exec(“su”);

var reader = new DataInputStream(process.getInputStream());

var writer = new DataOutputStream(process.getOutputStream());

writer.writeBytes(cmd+’\n’);

writer.flush();

writer.close();

var tmp;

var output = new StringBuffer();

while((tmp = reader.readLine()) != null){

output.append(tmp+’\n’);

}

reader.close();

process.waitFor();

}catch(err){

return err;

}

return output;

}

]]>

Is it possible to use something like setInterval in a script?

Is it possible to use something like setInterval in a script? I’ve been trying to create a simple animation that fades text transparency from 0 to 255 every second. It would seem that setInterval is the best way to do this, but I have been receiving an error. Here’s my code:

i=”0″;

function setI(i){

if(i=”0″){i=”255″}

else if(i=”255″){i=”0″};

return animate(i);}

setInterval(setI(),1000);

]]>

This is a binding to get the same result as the dynamic calendar icon script, but now from a binding in the dummy…

This is a binding to get the same result as the dynamic calendar icon script, but now from a binding in the dummy property (an alternative way, can’t tell which one is better).

The instructions are the same as the old script (http://www.lightninglauncher.com/wiki/doku.php?id=script_dynamic_calendar_icon) but now you can simply use lightning variables to set it to show the day or the month ( $ll_day or $ll_month respectively)

http://www.lightninglauncher.com/wiki/doku.php?id=script_dynamic_calendar_icon
]]>

A few weeks ago i posted some script ideas I thought I wouldn’t have time for to make.

A few weeks ago i posted some script ideas I thought I wouldn’t have time for to make. As I kinda needed one of them to continue developing another script I’m making I just started working on that one first. And now it’s finished 😀 (at least publishable).

With this script you can create a custom view which you can use as log while developing other scripts. For more information see my post from a few weeks ago: https://plus.google.com/100430440392224314007/posts/jMArUGsCeL2

Download and more info on how to use etc.: http://www.lightninglauncher.com/wiki/doku.php?id=script_customviewlog

Please leave any questions/comments/feedback below :)

http://www.lightninglauncher.com/wiki/doku.php?id=script_customviewlog
]]>

From the author of the ‘variable editor’ here comes the binding dictionary yay!

From the author of the ‘variable editor’ here comes the binding dictionary yay!

The idea behind this script was a simple one: allow to organize a bit the bindings and have them stored for multiple use. Then I started adding features, tweaking menus… ~600 lines of code at the end (almost half of them are empty, but impressive nonetheless).

How to use it:

– simply run it and choose what you want to do. Check the features for more information.

Features:

– Add bindings directly from text, writing/pasteing them.

– Add binding from the current item (you need to run the script from an item)

– Add all bindings on the launcher: this will search all bindings from all items from the launcher to save them (will ask one by one without duplicates)

– Rename a saved binding

– See/Edit/Delete a saved binding

– Set a saved binding to the current item (you need to run the script from an item) at a chosen property.

Configuration:

– You can change the folder where the data (the bindings) are saved.

Notes:

– When choosing a property, VOID means DUMMY

– Editing the bindings folder from outside will only take effect after restarting the script (and is recommended to not do it while the script is running)

– You can remove/add/edit manually the files without problem (if you don’t do strange things). You can make a copy, delete all at once, add some, etc

Important:

– Due to the complexity of the script, it may contain bugs. If you find one don’t be afraid of tell me in the comments.

]]>

Hi, 2 things I can’t get to work:

Hi, 2 things I can’t get to work:

1: enabling scrollbar on a custom textview. setVerticalScrollBarEnabled(true) just runs normally and isVerticalScrollBarEnabled() returns true, but I still don’t see a scrollbar

2: importing android.view. LL.bindclass(“android.view”) returns false and i need this because i want to enable fling to my textview.

Any help is very much appreciated 🙂

]]>

TrianguloY  Idea…

TrianguloY  Idea…

In past, you are doing game… snake…

what about doing somehing this:

https://robotwhale.files.wordpress.com/2014/06/breakout.gif?w=682 ?

With horizontal page indicator 😉

https://robotwhale.files.wordpress.com/2014/06/breakout.gif?w=682
]]>

This is a small script I use to make tutorials and bug reports. Feel free to use it in your own videos.

This is a small script I use to make tutorials and bug reports. Feel free to use it in your own videos.

The script makes a label to cycle between sublabels, and shows the text with a small animation.

Note: the script is very simple, I could have make it more complex making it to auto configure itself, but instead I leave it small and commented it in case you want to learn a bit from it.

The video shows the recommended configuration

Disclaimer: the part where I almost deleted the custom font and even choosed a wrong one wasn’t intended. 😅

]]>

Hi, I’ve had so many ideas for scripts recently and I’ve come to the conclusion that it would take ages before they…

Hi, I’ve had so many ideas for scripts recently and I’ve come to the conclusion that it would take ages before they would all be finished if I would be making them. So I’m dropping them here so if anyone who has the time and wants to do them can make them. All feedback and suggestions are of course welcome as always 🙂

1: logscript

This script will when run in a container will make a custom text view. There should be a function named log(String) in it so you can eval(logscript) and use this function in every script you like. I want this because the alert() function kinda disrupts the script flow and if you run alert() in a loop it might take a lot of pressing “ok” before you get the one you want and it’s really easy to skip it. A scrollable text view would be much more convenient I think :).

The script could also have en error catching function done like this: if the script text is not in a container or on create/destroy of the custom view, then it is run in an eval(), so LL.getCurrentScript() will return the script with the eval() in it. You can then get it’s text, remove the line where it says eval(logscript) and then eval() the script text in a try-catch in the logscript, so you can log the error in the custom view (in red text would be nice 🙂 ). (Sorry for my pour explanation skills, but hopefully you get the idea).

This would be useful because really often when I’m scripting I get an error and then I start thinking of why it might be caused and after a while i’m like: what was the error again exactly? And then I have to run the script again and do all the things that make it work and it gets really repetitive and annoying.

2: Script manager

I know there already is a script manager, so this will just be a few feature suggestions I guess.

2.1: the way i originally imagined it was a script that when run in a container would make shortcuts for all the scripts in that container. On tap of the shortcut it would open the script in the default script editor. Opening with another app of choice would be nice too.

The reason this is the way i would like it is that I have quite a lot of scripts and I have to scroll a lot before i find the one I’m looking for. In a panel i could order the items in a grid, which would be much easier to navigate I think. Also we could do all the cool stuff with items and panels that are in LL bent default, for example making folders and changing icons and make even more panels. The options menu would probably a little harder, but the script that sets up your app drawer in any container has is to, so it is definitely possible. And if even that fails it would also be possible to just pop in some items which serve as the list items.

2.2 not only search function for script text, but also for script name. Just like it is in the app drawer for apps. It would be nice if it also recursively searches containers in the main script container, so folders and panels.

2.3 sort by name and modified date. If you have to assume scripts editor is only lanched from the panel it’s fine imo.

2.4 one last thing: automatic grouping of different versions of one script in folders. I think this can be done by checking if a script name has a number at the end and if so search for other scripts with the same name without the version number.

3: better script editor

it might be better that this is done in an entirely separate app, or that Pierre Hébert​​​​​ just improves the script editor, but if everything else gets finished before that, i’m definitely going to work on it. So this editor would have the following features:

3.1: integration with the script editor, so script manager can open scripts

3.2: also give autocomplete options for custom variablenames and functions

3.3: only give autocomplete options available for the object. For example: if I type “item.get” it would not give getCurrentDesktop() as available option.

3.4 autocomplete suggestions for functions also display the arguments that the function takes (and maybe colors an argument red if it’s not of the right type?)

3.5 autocomplete suggestions are displayed in a list to the right from the cursor with the currently selected suggestion see through, so if I for example type “item.getp” it would put the letters “ositionX()” after if it in green text or something and then put a box around “item.getpositionX()”. If i then tap that box, or enter “.” or “)” or some other character I could continue with it will change it to “getPositionX()” (note the difference in the “p”).

3.6 autocomplete suggestions are sorted in alphabetical order and the ones that come before the currently selected one will be displayed on top of the box of the selected one in their own boxes. The same for the ones that come after the selected one, but that beneath the box of the selected one. The boxes should certainly not overlap the keyboard though.

3.7 the currently selected autocomplete suggestion is determined by where on the screen you’re typing. For example if you are typing just above your keyboard the selected suggestion is the last one of the list of suggestions that fits on the screen and if your typing on top it would be the topmost.

3.8 last but not least: of you have LL.bindClass() somewhere in your script the corresponding library will be added to the autocomplete system.

3.9: I think this has already been suggested once or twice, but long tap on an autocomplete suggestion should show a popup with explanation of it is a function or a static value

3.10 syntax highlighting

3.11 autoclose (), {}, “” and [] and if everything is closed also insert ; before enter to next line

3.12 auto-indentation

3.13 ability to select a bunch of text and indent/unindent(?)

3.14 search and replace

I know this is currently in the script manager, but i think it belongs in the editor

3.15 buttons for () , {} and other characters often used in coding (just like in quoda). I personally don’t need the ones with the numbers, the 2 rightmost ones and the left most one because I’ve no idea what those things do

I know i’m asking for quite a lot, but i think it is better to throw the entire list of desired features a out at once instead of one after the other. I know this has been quite a log post, so if you got this far thank you for reading and I hope to see your response in the comments 🙂

Regards Colin de Roos

]]>

I just uploaded my scriptlib to jcenter.

I just uploaded my scriptlib to jcenter.

That means: you can use it even easier now! No manual download, no flatDir required, just one line in build.gradle.

And additionally: Sources and javadoc are available this way too.

All you need is this dependency:

compile ‘com.faendir.lightninglauncher:scriptlib:1.6.4’

For more infromation about scriptlib:

http://www.lightninglauncher.com/wiki/doku.php?id=import_a_script_directly_into_ll

]]>