Is there a script which loops through the pages of a panel automatically (with a delay)?

Is there a script which loops through the pages of a panel automatically (with a delay)?

If not, can somebody help me writing one?

]]>

15 Commentsto Is there a script which loops through the pages of a panel automatically (with a delay)?

  1. Anonymous says:

    < ![CDATA[

    Like a slideshow ?

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Try this, where 8 is your panel id. Soon it will be possible to name all objects using a label instead of using internal ids.



    var p=LL.getCurrentDesktop().getItemById(8);


    var c=p.getContainer();


    p.setTag(0);


    var num_pages=3;



    var rotate = function() {


    var i=parseInt(p.getTag());


    if(i==num_pages-1) i=0;


    else i=i+1;


    p.setTag(i);


    c.setPosition(i*p.getWidth(), 0);


    setTimeout(rotate, 3000);


    }



    rotate();

    ]]>

  3. Anonymous says:

    < ![CDATA[

    var p=LL.getHomeDesktop().getItemById(128);


    var c=p.getContainer();


    p.setTag(0);


    var num_pages=5;



    var rotate = function() {


    var i=parseInt(p.getTag());


    if(i==-1)return;


    if(i==num_pages-1) i=0;


    else i=i+1;


    p.setTag(i);


    c.setPosition(i*p.getWidth(), 0);


    setTimeout(rotate, 3000);


    }



    rotate();



    ————–second script—————-


    var p=LL.getHomeDesktop().getItemById(128); var i=parseInt(p.getTag());


    if(i==-1)LL.runScript(“AutoScroll”,null);


    else p.setTag(-1);



    I created a second script and manipulated the first one, so I can start and stop the slideshow from anywhere

    ]]>

  4. Anonymous says:

    < ![CDATA[

    I’ve standardized the scripts (see wiki)

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Hey +Lukas Morawietz – cool script. Ive got it on a stock 4.2 SGS3 GTi9300 Llx 10.3. I have a panel on desktop with two folders in adjacet pages within the panel. Performance is ‘skittish’ for lack of a better term. Speed seems variable per run and even within run. Runtime of script seems to vary sometimes ending in blank page with no way of scrolling back to start. In this instance running main script from panel event on load seems void even after navigating from other desktop…?



    For further testing ive set up the toggle via desktop shortcut outside panel, seems more stable but still not solid.



    I also set up a tasker autoshortcut shortcut on seperate desktop which calls llx script to home/ wait two seconds / toggle autoscroll… gets to home desktop then nothing.



    For the speed/jitter issue I tried various numbers for the last timeout on main script (5000) …



    Hope this reads logically and helps.. Im no programmer, just some very novice hacking



    Regards





    Nigel

    ]]>

  6. Anonymous says:

    < ![CDATA[

    Nigel Stewart So you have a panel with two pages, and you want to switch 1-2-1-2…?



    If the speed is variable there are probably multiple instances running.



    However this script was my first, and it’s mainly not persistent. Wait a second, I’ll recode it from start.

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Best outcome so far:



    Run toggle from desktop shortcut


    End AutoScroll from panel doubletap



    For some unkown reason this works, also noticed toggle doesn’t pop toast

    ]]>

  8. Anonymous says:

    < ![CDATA[

    Correct.. I just set it up to demo the script. .. have tried 1-2-3 with two as blank page.. works same.

    ]]>

  9. Anonymous says:

    < ![CDATA[

    Anyway, great idea, big ups to you and your fellow scripters. I always wanted to set up a tablet for work which would double as an offline site (in field no coverage) with system intergration – scripts like this one and the foundation of LL make it ever increasingly possible to have it all and without having to learn a new language… I gave up after html at the millenium… my background is design, its great to be able to focus on that with minimal technical knowledge. Cheers

    ]]>

  10. Anonymous says:

    < ![CDATA[

    Nigel Stewart would you try this out for me?


    Running it once from anywhere should enable sliding, running again should disable it.


    For example you can set it in resumed and paused event of your desktop


    Sorry for using ID, not label, but due to a problem with load and resumed event, it only works this way.

    ]]>

  11. Anonymous says:

    < ![CDATA[

    //config


    var waitingTime=3000;//time between page switches, in ms, not exact


    var panelID=0x040001;//if you take the ID from hierachy, put a ‘0x’ in front of it


    var notify=true;//mainly for debug, creates toasts with status


    //endconfig



    //start


    if((typeof running===’undefined’||!running))


    {


    var c=LL.getItemById(panelID).getContainer();


    if(c==null)


    {


    if(notify)Android.makeNewToast(“Failed to load panel”,true).show();


    return;


    }


    running=true;


    start();


    }


    //stop


    else


    {


    running=false;


    }



    function start()


    {


    w=c.getWidth();


    if(w==0)


    {


    setTimeout(start,50);


    return;


    }


    b=c.getBoundingBox();


    l=b.getLeft();


    d=b.getRight()-l;


    y=c.getPositionY();


    if(notify)Android.makeNewToast(“Slideshow started”,true).show();


    step();


    }



    function step()


    {


    if(!running)


    {


    if(notify)Android.makeNewToast(“Slideshow stopped”,true).show();


    return;


    }


    if(typeof a===’undefined’)a=0;


    a+=2;


    if(a>=waitingTime)


    {


    var goTo=(Math.floor(c.getPositionX()/w)*w-l+w)%d+l;


    c.setPosition(goTo,y);


    a=0;


    }


    setTimeout(step,1);


    }

    ]]>

  12. Anonymous says:

    < ![CDATA[

    Smooth work, thanks a lot.



    While testing now I noticed system widget ‘Picture Frame’ which is reasonably configurable… got to thinking a panel with multi pic frames and autoscroll would be quite slick showcasing for visual portfolio work.



    It works when some items are pinned, that make a persistent area for say banners etc.



    Works with Tasker autoshortcut.



    So after thinking and researching for five years I can now do easily on android what ought to have been stock on a apple fifteen years ago but never was, and would have taken oodles of applescripting…



    Easily intergrate smart playlist audio with slideshow… just need to find a good line into something like fstop over stock gallery for more dynamism.. AND.. it can all be conditional to environment…



    Lukas, this script takes all that to another level with another layer, and it is only through trialling autoscroll that Ive seen the methodology for fitting the pieces of the puzzle together…



    Im not holding onto it to tight, but can you imagine the potential with things like point of sale multimedia being responsive… could be tailored presentations depending on form input.



    Going off topic I know, but it is a breakthrough moment and this was the catalyst.



    Thanks again

    ]]>

  13. Anonymous says:

    < ![CDATA[

    excuse me, but can you do this vertically? because i tried it and its awesome. but i cant seem to make it slide vertically. thanks!

    ]]>

  14. Anonymous says:

    < ![CDATA[

    oh wow. thanks! now it looks like a live tile @.@ thank you sir.

    ]]>

Leave a Reply

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