New kludge incoming :D

New kludge incoming 😀

Create a Desktop by Script: this script provides the function createDesktop(name)

]]>
« (Previous Post)
(Next Post) »

3 Commentsto New kludge incoming :D

  1. Anonymous says:

    < ![CDATA[

    //import java classes


    LL.bindClass(“java.io.FileReader”);


    LL.bindClass(“java.io.BufferedReader”);


    LL.bindClass(“java.io.FileWriter”);


    LL.bindClass(“java.io.File”);


    LL.bindClass(“java.lang.System”);



    //create a new Desktop with specified name


    createDesktop=function(name)


    {


    //create the needed structure


    var file=new File(“data/data/net.pierrox.lightning_launcher_extreme/files/config”);//this file contains desktop properties


    var r=new BufferedReader(new FileReader(file));


    var s=””;



    //read the file


    var l=r.readLine();


    while(l!=null)


    {


    s+=l;


    l=r.readLine();


    }


    //edit the properties


    var data=JSON.parse(s);


    data.screensNames.push(name);


    var newId=0;


    while(data.screensOrder.indexOf(newId)!=-1)newId++;


    data.screensOrder.push(newId);



    //write the changed stuff back to the file


    var w=new FileWriter(file);


    w.write(JSON.stringify(data));


    w.flush();


    w.close();



    //restart the launcher


    System.runFinalization();


    System.exit(0);


    }

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Something you can do is use JSON.parse(s).


    This way you can directly access data without messing with characters.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Updated with JSON

    ]]>

Leave a Reply

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