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

]]>

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

  1. Anonymous says:

    < ![CDATA[

    Great ideas! Really like the logger I’ll try to make my own 🙂

    ]]>

  2. Anonymous says:

    < ![CDATA[

    For the logger, other ideas (complementary) :



    1.1 Keep a log with about 200 lines (configurable) per scripts



    1.2. Having multiple channel of logs per scripts : error, debug, normalLog,



    1.3. Ability to make custom view (like you said) to see logs of multiple running scripts at once, apply filters (to see only logs of 1 or 2 script(s) ), and for each scripts, chooses which log channel you want…

    ]]>

  3. Anonymous says:

    < ![CDATA[

    1.1: is certainly possible i think, but if you are using one log for multiple scripts you might want to implement some loading on request mechanic, so for example when the customview is resumed it loads only about 10 lines or however many you are able to see whitout scrolling and only when you scroll up more logs are loaded from a file somewhere in the lightning launcher folder.



    1.2: Could certainly be useful indeed 🙂



    1.3: filtering logs on script and loglevel is certainly possible, but filtering on different loglevels for different scripts is a bit overkill ad far as i’m concerned. 1 global filter for scripts and 1 global filter for loglevel would suffice i think.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    You’re right for 1.3 it’s a bit overkill..



    2. The best for script versioning would be to be able to use git !! But that’s another story…

    ]]>

  5. Anonymous says:

    < ![CDATA[

    2 haha yeah. Probs to you if you get that working 🙂



    Btw i also added a few feature ideas to the custom script editor if you’re interested

    ]]>

  6. Anonymous says:

    < ![CDATA[

    For the code editor: here is an abandoned project of me: https://github.com/F43nd1r/LLXCodeEditor/tree/master/app/src/main/java/com/app/lukas/llxcodeeditor


    Feel free to reuse anything.

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Lukas Morawietz Wow, looks really impressive. What have you implemented so far?

    ]]>

  8. Anonymous says:

    < ![CDATA[

    Colin de Roos it has basic autocomplete with type tracking on a static set of methods. I gave up on it because I realized: you can’t do type tracking in javascript without executing the code. But LL scripts are situational, so you can’t execute them for their one and only result. So you can’t do type tracking in LL scripts.

    ]]>

  9. Anonymous says:

    < ![CDATA[

    Aha, that’s a bit of a problem. Isn’t it possible to just check what a method returns when it’s written? So for example I would type “var it = event.getItem()” and then it would know that the object type of the variable it = Item. This might be complete nonsense, but that’s just my thinking.

    ]]>

  10. Anonymous says:

    < ![CDATA[

    Colin de Roos


    that works in most cases, but javascript also allows this:


    var a;


    if(LL.getCurrentDesktop().getId()==0){


    a=”thisisastring”;


    }


    else{


    a=[“thisisanarray”];


    }



    So, in this case you can’t determine the type of a.

    ]]>

  11. Anonymous says:

    < ![CDATA[

    Hmm that is a problem indeed. I guess you would have to do both in that case

    ]]>

  12. Anonymous says:

    < ![CDATA[

    Indeed, JavaScript makes type tracking extremely difficult, even impossible. I am afraid this isn’t manageable.


    Regarding the script editor, yes, I’ll probably do something this month if I have time left for it. Syntax highlighting is far, but fast scrolling, remember the scroll position, autoclose, autoindent and things like that will come first. This isn’t hard, but takes time, as everything else.

    ]]>

  13. Anonymous says:

    < ![CDATA[

    Benoît de Chezelles have you made any progress on the logging script yet? If so, what do you have already and maybe we could figure out someway we can work on it together if you want. If not I’ll be starting on my own version this weekend

    ]]>

  14. Anonymous says:

    < ![CDATA[

    Hi, I didn’t start, I’m busy until next weekend. It would be great to work together, but I’m not available this weekend, neither next week. But if you want to begin, go for it !

    ]]>

  15. Anonymous says:

    < ![CDATA[

    No problem, i’m on it!

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *