Custom JavaScript examples - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Custom JavaScript examples (/showthread.php?tid=275) |
RE: Custom JavaScript examples - Domoticatorino - 09.03.2018 (15.04.2016, 21:32)Erwin van der Zwart Wrote: Another nice custom Javascript feature: Back to startpage after x seconds when there is no user input:Hi Erwin, further to this above. It is possible to log out as well. What do you suggest? Thanks. RE: Custom JavaScript examples - Erwin van der Zwart - 09.03.2018 Hi, Yes you could. Add after line 24 a redirect to /logout (after showPlan) BR, Erwin RE: Custom JavaScript examples - Domoticatorino - 16.03.2018 Hi Erwing, What is exactly the instruction? Simply what you wrote Thanks. RE: Custom JavaScript examples - Domoticatorino - 17.03.2018 (09.03.2018, 07:23)Erwin van der Zwart Wrote: Hi, So instruction is the following? showPlan (redirect to /logout) Thanks. RE: Custom JavaScript examples - Erwin van der Zwart - 17.03.2018 Hi, No, that would be to easy (: Add this after line 24: Code: $(location).attr("href", "/logout"); Code: var SE_Goto_Startpage = No_Usage_Detected(function(e) { Erwin RE: Custom JavaScript examples - Domoticatorino - 17.03.2018 Thank you Erwin, I'll try. RE: Custom JavaScript examples - Mrinj - 24.03.2018 Hi, Please excuse the question but I’m newbie who’s been reading and testing and still can not connect the dotts: How to read/write % value to a virtual object 32/1/1 from a custom created java script (in notepad), saved as html, uploaded as image to Wizer and imported in frame/url in a visualization? Do I need to have a starage.lp for multiple addresses? Can someone please replay with a short step by step guide or a simple js example? Best, RE: Custom JavaScript examples - admin - 25.03.2018 Can you explain what kind of task do you have? RE: Custom JavaScript examples - Erwin van der Zwart - 25.03.2018 Hi, HTML files with embedded JS uploaded to the images folder and added to the visu by using a frame is a very old way to include custom JS to the visu. Now we have (quite a while already) Custom JS so the old methode above is not needed anymore. Just like Admin asked, what do you need to do? BR, Erwin RE: Custom JavaScript examples - Mrinj - 25.03.2018 I've been reading post (probably old), testing and maybe that's why is confusing for me. Excuse me please! My plan was to enter a number and save/read the value to an object (in %) from an image (probably with script) that is embedded in visualization, frame and via /scada/resources/icons/image.html. I know this can be done in visualization, object and then by choosing the object address, but the idea is that multiple objects can be saved. How can this be done with Custom JS? RE: Custom JavaScript examples - Erwin van der Zwart - 25.03.2018 Hi, Why don't you just add a normal value or string object(s) to the visu? Can you explain why you are thinking that you need to do this by using JS? BR, Erwin RE: Custom JavaScript examples - Mrinj - 25.03.2018 Probably it will be best and easiest with normal value in visu. And probably I've been reading & trying to hard to understand the principles of JS and Wiser. Thanks for your time, advice and help! RE: Custom JavaScript examples - suporte.arqtech - 06.08.2018 Hello Is it possible to repeat a command while I hold down a button with the short / long press script? I need a volume button for a TV in witch the user doesn´t need to press several times to achieve the desired level. BR, Jefferson RE: Custom JavaScript examples - DGrandes - 29.04.2019 (06.08.2018, 20:31)suporte.arqtech Wrote: Hello Hi, I want to do it too. I need to send a byte number continually while i press + or - button. For example, while I press +, send "30" to group address 1/1/1, and when I press -, sen "31" to 1/1/1 Thanks RE: Custom JavaScript examples - admin - 29.04.2019 You don't need custom JS for this. Use binary objects in start/stop mode and this script for conversion to 1-byte scaled: https://forum.logicmachine.net/showthread.php?tid=51&pid=298#pid298 RE: Custom JavaScript examples - DGrandes - 30.04.2019 (29.04.2019, 17:00)admin Wrote: You don't need custom JS for this. Use binary objects in start/stop mode and this script for conversion to 1-byte scaled: https://forum.logicmachine.net/showthread.php?tid=51&pid=298#pid298 Thanks! It works. I have another question. I want to get "send fixed value" data from object when i click on element. I know that to know the object, the code is el.data("object"), and for status object, el.data("status-object"), but i don't know others. Is there any documentation about this? Thanks RE: Custom JavaScript examples - admin - 30.04.2019 Fixed value is not stored in data attributes. Why do you need this feature? RE: Custom JavaScript examples - DGrandes - 30.04.2019 (30.04.2019, 11:59)admin Wrote: Fixed value is not stored in data attributes. Why do you need this feature? For the same example that I explained before. I have seen that by modifying the example code for dimming lights, I can use it for my case. But I wanted to make a generic code, because the same object is used for many actions. I wanted to put the sending value in "send fixed value" in each object and take it in JS. The button's to control the volume are in the LM visualisation, and i the solution that you give me, I have to create a JS to simulate the push button (1 on press, 0 on release) too. RE: Custom JavaScript examples - admin - 30.04.2019 In visualization parameters you can set the button to work in start-stop mode: send 1 on press and 0 on release. RE: Custom JavaScript examples - DGrandes - 30.04.2019 (30.04.2019, 14:04)admin Wrote: In visualization parameters you can set the button to work in start-stop mode: send 1 on press and 0 on release. Ok, thanks! I didn't know it |