Posts: 120
Threads: 40
Joined: Jun 2017
Reputation:
0
Hello colleagues, my questions is if it is possible by script to get the time that the browser has and load it to the logic machine, something like clicking the "get from system" button that is in the "utilities / date and time" tab ". The above because I will have a logic machine and in case the date is out of order, the client can update the date without having to enter the integrator or administrator mode. Thank you and I am attentive to your comments.
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Does your LM have internet access? You should set correct gateway and DNS settings. Then enable NTP client.
Posts: 120
Threads: 40
Joined: Jun 2017
Reputation:
0
No, they will not have internet access. Everything will be done through a local network.
Posts: 4643
Threads: 24
Joined: Aug 2017
Reputation:
207
You could do it from visu with such script
Code:
date = grp.getvalue('date_object')
time = grp.getvalue('time_object')
cmd = string.format("date -s '%d-%d-%d %d:%d:%d'", date.year, date.month, date.day, time.hour, time.minute, time.second)
os.execute(cmd)
------------------------------
Ctrl+F5
Posts: 120
Threads: 40
Joined: Jun 2017
Reputation:
0
Hi Daniel, thanks for answering and for the script. This Script would be useful if the user enters the date and time manually so that the logic machine will be loaded with the script and the time, but will there be any way instead of the time And date manually, does the logic machine do the equivalent of the "get from system" button, but by means of a script do you place it? So that the user does not have to type the time and date manually, but instead takes the time of the device where he is viewing. Thank you and I am attentive to your comments.
Posts: 120
Threads: 40
Joined: Jun 2017
Reputation:
0
Hi admin, thanks for replying. I understand that it is an LP file and I know how I should upload it, the problem is that I do not understand how I associate the button that I am going to use with the LP file? . Thanks and I'm attentive
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Include it via iframe. You can adjust button style by adding CSS directly to .lp file.
Posts: 120
Threads: 40
Joined: Jun 2017
Reputation:
0
Partners, thanks for your collaboration! I made a mix, using the LP file and also the code that Daniel sent me, because I had to synchronize the time and date of several logic machines through Http request. Thank you.