Posts: 36
Threads: 10
Joined: Sep 2021
Reputation:
0
Hello
Did anyone make a flashing alert by Scrip?
Someone can help or send a scrap, of course in no-alert mode, the flicker stops. Regards
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Do you want to do this in standard visualization or Mosaic? What kind of alert do you want - an icon or text label? What type is the alert object - 1 bit or something else?
Posts: 36
Threads: 10
Joined: Sep 2021
Reputation:
0
(28.09.2021, 05:45)admin Wrote: Do you want to do this in standard visualization or Mosaic? What kind of alert do you want - an icon or text label? What type is the alert object - 1 bit or something else?
Greetings
Thanks for the reply I want an alert in the icon, in 1 bit, I did not understand what is visualization or Mosaic. I work in a visualization screen. Thanks
Posts: 167
Threads: 20
Joined: Apr 2017
Reputation:
2
28.09.2021, 17:13
(This post was last modified: 28.09.2021, 17:15 by Dré.)
You can do it with a transparent picture if there is no problem
and a animated gif with to pictures in it, 1 transparent and one with symbol of problem you want.
something like this
sourch: https://commons.wikimedia.org/wiki/File:Alert.gif
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Animated GIF is an easy solution.
This can also be achieved with Custom JavaScript. This example will show/hide all elements with additional class set to alert every second when 0/1/24 value is set to true. You can also change $('.alert').removeClass('hide'); to $('.alert').addClass('hide'); to hide the element when the object value is false.
Code: $(function(){
if (window.grp) {
var timer;
grp.listen('0/1/24', function(object) {
if (object.value) {
if (!timer) {
timer = setInterval(function() {
$('.alert').toggleClass('hide');
}, 1000);
}
}
else {
$('.alert').removeClass('hide');
clearInterval(timer);
timer = null;
}
});
};
});
Posts: 321
Threads: 72
Joined: Jan 2021
Reputation:
0
(29.09.2021, 06:12)admin Wrote: Animated GIF is an easy solution.
This can also be achieved with Custom JavaScript. This example will show/hide all elements with additional class set to alert every second when 0/1/24 value is set to true. You can also change $('.alert').removeClass('hide'); to $('.alert').addClass('hide'); to hide the element when the object value is false.
Code: $(function(){
if (window.grp) {
var timer;
grp.listen('0/1/24', function(object) {
if (object.value) {
if (!timer) {
timer = setInterval(function() {
$('.alert').toggleClass('hide');
}, 1000);
}
}
else {
$('.alert').removeClass('hide');
clearInterval(timer);
timer = null;
}
});
};
});
great and easy, alternative to creating GIF.
But how to make it depend on the element value (Binary) instead of a specific object?
Best Regards,
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Posts: 321
Threads: 72
Joined: Jan 2021
Reputation:
0
29.09.2021, 10:22
(This post was last modified: 29.09.2021, 10:22 by khalil.)
(29.09.2021, 08:16)admin Wrote: You can find the mapped group address like this: https://forum.logicmachine.net/showthrea...5#pid20275
Thank you admin for advising me to do it by myself.
This is what I did is there any advice?
Code: // Flashing Alert
$(function(){
$('.alert').each(function(_, el) {
var timer;
var addr = $(el).data('object');
if (addr) {
grp.listen(addr, function(obj) {
if (obj.value) {
if (!timer) {
timer = setInterval(function() {
$('.alert').toggleClass('hide');
}, 500);
}
}
else {
$('.alert').removeClass('hide');
clearInterval(timer);
timer = null;
}
});
};
});
});
Best Regards,
Posts: 36
Threads: 10
Joined: Sep 2021
Reputation:
0
(29.09.2021, 10:22)khalil Wrote: (29.09.2021, 08:16)admin Wrote: You can find the mapped group address like this: https://forum.logicmachine.net/showthrea...5#pid20275
Thank you admin for advising me to do it by myself.
This is what I did is there any advice?
Code: // Flashing Alert
$(function(){
$('.alert').each(function(_, el) {
var timer;
var addr = $(el).data('object');
if (addr) {
grp.listen(addr, function(obj) {
if (obj.value) {
if (!timer) {
timer = setInterval(function() {
$('.alert').toggleClass('hide');
}, 500);
}
}
else {
$('.alert').removeClass('hide');
clearInterval(timer);
timer = null;
}
});
};
});
});
Thanks for the answers I will try thanks
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
If you reference $('.alert') further in the code this means that all elements with alert class will be flashed if at least one objects is set to true. So it won't work for multiple/different alert objects. Try this (not tested):
Code: $(function() {
$('.alert').each(function(_, el) {
var $el = $(el);
var addr = $el.data('object');
var timer;
if (addr) {
grp.listen(addr, function(obj) {
if (obj.value) {
if (!timer) {
timer = setInterval(function() {
$el.toggleClass('hide');
}, 500);
}
}
else {
$el.removeClass('hide');
clearInterval(timer);
timer = null;
}
});
}
});
});
Posts: 321
Threads: 72
Joined: Jan 2021
Reputation:
0
(29.09.2021, 10:36)admin Wrote: If you reference $('.alert') further in the code this means that all elements with alert class will be flashed if at least one objects is set to true. So it won't work for multiple/different alert objects. Try this (not tested):
Code: $(function() {
$('.alert').each(function(_, el) {
var $el = $(el);
var addr = $el.data('object');
var timer;
if (addr) {
grp.listen(addr, function(obj) {
if (obj.value) {
if (!timer) {
timer = setInterval(function() {
$el.toggleClass('hide');
}, 500);
}
}
else {
$el.removeClass('hide');
clearInterval(timer);
timer = null;
}
});
}
});
});
That's right, I didn't notice that because I tested it on one object
your script seems to work fine, I tested it for two objects and work fine
Best Regards,
Posts: 36
Threads: 10
Joined: Sep 2021
Reputation:
0
(29.09.2021, 06:12)admin Wrote: Animated GIF is an easy solution.
This can also be achieved with Custom JavaScript. This example will show/hide all elements with additional class set to alert every second when 0/1/24 value is set to true. You can also change $('.alert').removeClass('hide'); to $('.alert').addClass('hide'); to hide the element when the object value is false.
Code: $(function(){
if (window.grp) {
var timer;
grp.listen('0/1/24', function(object) {
if (object.value) {
if (!timer) {
timer = setInterval(function() {
$('.alert').toggleClass('hide');
}, 1000);
}
}
else {
$('.alert').removeClass('hide');
clearInterval(timer);
timer = null;
}
});
};
});
Hello
I entered the script but I have a lot of error messages you can check it again thanks
? p.s my object 1/7/20 thanks
Posts: 321
Threads: 72
Joined: Jan 2021
Reputation:
0
(29.09.2021, 19:53)Nir70 Wrote: (29.09.2021, 06:12)admin Wrote: Code: $(function(){
if (window.grp) {
var timer;
grp.listen('0/1/24', function(object) {
if (object.value) {
if (!timer) {
timer = setInterval(function() {
$('.alert').toggleClass('hide');
}, 1000);
}
}
else {
$('.alert').removeClass('hide');
clearInterval(timer);
timer = null;
}
});
};
});
Hello
I entered the script but I have a lot of error messages you can check it again thanks
? p.s my object 1/7/20 thanks
I used the script and its works fine.
do you insert the script in the custom JavaScript page: Scripting> Tools> Edit custom JavaScript
Best Regards,
Posts: 36
Threads: 10
Joined: Sep 2021
Reputation:
0
(30.09.2021, 07:00)khalil Wrote: (29.09.2021, 19:53)Nir70 Wrote: (29.09.2021, 06:12)admin Wrote: Code: $(function(){
if (window.grp) {
var timer;
grp.listen('0/1/24', function(object) {
if (object.value) {
if (!timer) {
timer = setInterval(function() {
$('.alert').toggleClass('hide');
}, 1000);
}
}
else {
$('.alert').removeClass('hide');
clearInterval(timer);
timer = null;
}
});
};
});
Hello
I entered the script but I have a lot of error messages you can check it again thanks
? p.s my object 1/7/20 thanks
I used the script and its works fine.
do you insert the script in the custom JavaScript page: Scripting> Tools> Edit custom JavaScript Thanks, I inserted the scrap as you just said. How now I enable it after inserting a JavaScript page: Scripting> Tools> Edit custom JavaScript?
Posts: 321
Threads: 72
Joined: Jan 2021
Reputation:
0
30.09.2021, 09:00
(This post was last modified: 30.09.2021, 09:01 by khalil.)
[quote pid="23203" dateline="1632991948"]
Thanks, I inserted the scrap as you just said. How now I enable it after inserting a JavaScript page: Scripting> Tools> Edit custom JavaScript?
[/quote]
Just save
To see the effect you should open the PC/Tablet Page if you are using SL or W4KNX.
you will not see the effect on the visualization editor page.
Best Regards,
Posts: 36
Threads: 10
Joined: Sep 2021
Reputation:
0
(30.09.2021, 09:00)khalil Wrote: [quote pid="23203" dateline="1632991948"]
Thanks, I inserted the scrap as you just said. How now I enable it after inserting a JavaScript page: Scripting> Tools> Edit custom JavaScript?
Just save
To see the effect you should open the PC/Tablet Page if you are using SL or W4KNX.
you will not see the effect on the visualization editor page.
[/quote]
Hi, I'm not a JAWA expert. Do I need to add value / object to what you sent? I tried through the screen non-flashing visual, I just need a sample object 1/7/10 (1 bit) in the sample problem so it flashes at about 0 it does not flash. Thanks
Posts: 4643
Threads: 24
Joined: Aug 2017
Reputation:
207
Use this code
https://forum.logicmachine.net/showthrea...3#pid23183
and add additional calss 'alert' to your object in visu editor.
------------------------------
Ctrl+F5
Posts: 36
Threads: 10
Joined: Sep 2021
Reputation:
0
(28.09.2021, 17:13)Dré Wrote: You can do it with a transparent picture if there is no problem
and a animated gif with to pictures in it, 1 transparent and one with symbol of problem you want.
something like this
sourch: https://commons.wikimedia.org/wiki/File:Alert.gif
hello
Thank you very much, is this an icon you created? Can I create or change captions myself? ERRO for example? Regards
Posts: 4643
Threads: 24
Joined: Aug 2017
Reputation:
207
Create two images and convert them to gif, there are loads of sw available for example this https://imgflip.com/gif-maker
------------------------------
Ctrl+F5
Posts: 36
Threads: 10
Joined: Sep 2021
Reputation:
0
(28.09.2021, 17:13)Dré Wrote: You can do it with a transparent picture if there is no problem
and a animated gif with to pictures in it, 1 transparent and one with symbol of problem you want.
something like this
sourch: https://commons.wikimedia.org/wiki/File:Alert.gif
I tried thanks I took the same symbol (Alert) but the flicker disappeared
|