Hi all. New to this community, although I’ve used the awsome launcher that is LL for about half a year.

Hi all. New to this community, although I’ve used the awsome launcher that is LL for about half a year.

I need to assign an “if” condition to an event I’ve assigned to an icon. More specifically I want to set long press to open a folder in which I’ve added a Notifications’ Widget (my “makeshift” notification dot) ONLY if an unread notification exists for said app.

I’ve set up LL variables linked to Tasker variables that count notifications and successfully bound (using bindings) the multi tool unread badges’ visibility with a >0 statement for the LL variable that is linked to the Tasker notification count variable.

My question is how to link the same statement with the visibility (or rather the executability) of the long press to open folder action. I want the long press to open the folder if the unread badge is visible (which is the case of the notification count is >0) and do nothing if the unread badge is invisible (and notification count is 0).

Is there a script I could set up to do this?

I’d appreciate any member’s valuable ideas on this…

Apologies if this has been answered somewhere already, but I haven’t seen any such post in the search I’ve done.

10 Commentsto Hi all. New to this community, although I’ve used the awsome launcher that is LL for about half a year.

  1. You can do this from Tasker itself. Create a new task with a contrition that IF count >0, plugin» LLX» open a folder and set the folder to open. ENDIF. If count=0, nothing happens. Now, on the folder’s long tap event, point it to run this task.

    Hope this helps. I’m sure there’s a simple way using LLX script, but am a noob on that…

  2. Prasad Kaladi Thank you for your response. I’ve actually tried that, it does indeed work as intended, however opening the folder via the Tasker shortcut takes noticeably longer thank simply opening the folder through LL directly.

    Hence, why I was looking for help with a LL script that could be faster…

    Again, though, many thanks!

  3. Mirko Kohler says:

    You can use following script:

    var yourvar = LL.getVariables().getInteger(‘‘);

    var folder = LL.getCurrentDesktop().getItemByName(‘‘);

    if (yourvar > 0) {

    folder.launch();

    }

  4. Mirko Kohler Many thanks Mirko!

    So, to see if I got this right, if my variable is named $Inbox_count, and the folder name is (#c40001) should the script look like this?

    var $Inbox_count = LL.getVariables().getInteger(‘$Inbox_count’);

    var folder = LL.getCurrentDesktop().getItemByName(‘#c40001’);

    if ($Inbox_count > 0) {

    folder.launch();

    }

    I’m also not sure about the folder name: do I need the folder name in icon form or when open? (They’re different). Also, is #c40001 the Folder ID? If so, would I need a getItemByID syntax to get to the folder? Or should I assign a name for the folder and make it simpler?

    Again, many thanks for the support and sorry for the noob questions!!

  5. Edit – update:

    var Inbox_count = LL.getVariables().getInteger(‘Inbox_count’);

    var folder = LL.getCurrentDesktop().getItemByName(‘Inbox_Notifications);

    if (Inbox_count > 0) {

    folder.launch();

    }

    works absolutely fine if I have the folder (which I’ve named, in this case, Inbox_Notifications) in the desktop.

    However, said folder, is in nested (hidden, really) in 2 layers of folders, which reside in a panel, so, it’s actually 3 layers from Current Desktop to targeted folder.

    All 2 folders and the Panel are assigned names. Is there a way to edit the above code and use some syntax incl. getContainer() to get through these 3 layers and access the desired folder?

    Thanks!

  6. Mirko Kohler says:

    You can concat the functions:

    …getItemByName(‘folder1’).getItemByName(‘folder2’).getItemByName(‘Inbox_Notifications’);

    The function delivers an item which can be a folder or a shortcut. If it’s a folder, the folder has the function itself so you can concat the functions.

  7. Mirko Kohler Many thanks Mirko, I think I’m getting there.

    I’ve concatenated the functions and now my script looks like this:

    var Inbox_count = LL.getVariables().getInteger(‘Inbox_count’);

    var folder = LL.getContainerById(‘0x0000d0’).getItemByName(‘Folder_Other’).getItemByName(‘Notification_Dots’).getItemByName(‘Inbox_Notifications’);

    if (Inbox_count > 0) {

    folder.launch();

    }

    The Container with ID #0000d0 is the Panel in which the 3 nested folders reside in. The Panel is obviously an item / container in the Current Desktop.

    This script gives me the following error:

    At line 2: TypeError: Cannot call method “getItemByName” of null

    Using the script as follows:

    var Inbox_count = LL.getVariables().getInteger(‘Inbox_count’);

    var folder = LL.getCurrentDesktop().getContainerById(‘0x0000d0’).getItemByName(‘Folder_Other’).getItemByName(‘Notification_Dots’).getItemByName(‘Inbox_Notifications’);

    if (Inbox_count > 0) {

    folder.launch();

    }

    I get another error:

    At line 2: TypeError: Cannot find function GetContainerById in object Desktop 0

    So, I guess my issue is with the Panel (ID: #0000d0, which I’ve also named: Apps_Panel)

    Am I missing something in targeting the Panel properly before targeting the 3 consecutive folders? (Current Desktop>Panel>Folder1>Folder2>Folder3)?

    Again many many thanks for your support in this!

  8. Mirko Kohler says:

    Sorry my fault. Panel is also an item. But panel and folder need getContainer() for their items:

    LL.getCurrentDesktop().getItemByName(‘Apps_Panel’).getContainer().getItemByName(‘Folder_Other’).getContainer().getItemByName(‘Notification_Dots’).getContainer().getItemByName(‘Inbox_Notifications’);

  9. Mirko Kohler you, Sir, rock. It works like a charm now! Many thanks!

  10. Thank you Mirko Kohler for showing me how to read LL variables via script. I spent two hours finding that from api.reference, instead found a long script that reads LL variables from sdcard because, assumably, you cannot read them straight from LL. 😀

Leave a Reply

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