This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Custom JavaScript examples
(24.07.2024, 06:32)admin Wrote: Check this: https://forum.logicmachine.net/showthrea...2#pid17512

Thanks
Reply
Hi,

I would like to implement a haptic feedbak using Visualization on iPhone or Android phones.

Is this pssible with a custom java script?

Thanks and kind regards, Daniel
Reply
See this: https://developer.mozilla.org/en-US/docs...ration_API
It will only work on Android, Safari on iOS does not support this API.
Reply
Hello.
I have a variable that tells me there are new alerts ‘true’.
I would like that when I access the screen where I see the alerts, that variable automatically changes to ‘false’.
Can anyone help me?
Thank you.
Reply
What kind of variable? It is a group address?
Reply
A virtual bool one; 50/1/0
Reply
See this: https://forum.logicmachine.net/showthrea...3#pid21463
Reply
Something like this, keeping in mind that the screen ID is 112 and the variable is 50/1/0:

$(function(){
if (typeof grp == 'undefined') {
return;
}

$('body').on('showplan', function(event, id) {
if (id == 112) {
grp.write('50/1/0', 0);
}
}).trigger('showplan', [ currentPlanId ]);
});
Reply
Hi, I've tried the code and it's not working. Could someone help me with this? Thanks in advance.
Reply
Which Visualization tool do you use?
------------------------------
Ctrl+F5
Reply
(11.02.2026, 12:32)Daniel Wrote: Which Visualization tool do you use?

PC/Tablet
Reply
Change script to this, open browser dev tools (F12) and check what you get in the console. Are you sure that the target plan ID is 112?

Code:
$(function(){
  if (typeof grp == 'undefined') {
    return;
  }
  
  console.log('custom js initialized');

  $('body').on('showplan', function(event, id) {
    console.log('changed to plan', id);

    if (id == 112) {
      grp.write('50/1/0', 0);
    }
  }).trigger('showplan', [ currentPlanId ]);
});
Reply
When testing this will work from end visualisation not editor.
------------------------------
Ctrl+F5
Reply
Yes, panel ID is 112
And yes, I try it on end visualisation. Still not working.

I have a schnider wiser, I don't know if it is a problem.

Attached Files Thumbnail(s)
   
Reply
See my previous post, check browser console. Does 50/1/0 exist? Do you have anything else in Custom JS?
Reply
Your script works for me on SL, if it doesn't work then it is wrong ID or group.
------------------------------
Ctrl+F5
Reply
I have a 50/1/0 address that tells me there are new alerts. The idea I have in mind is that when I access the alerts panel, that variable automatically changes to 0, so that it is assumed that there are no new alerts.

Attached Files Thumbnail(s)
       
Reply
CSS is not JavaScript, check manuals where is the correct place.
------------------------------
Ctrl+F5
Reply
(11.02.2026, 13:52)Daniel Wrote: CSS is not JavaScript, check manuals where is the correct place.

Yes, you are absolutely right.
My mistake, I just tested it and the code works correctly.
Thank you very much.
Reply


Forum Jump: