I could manage to write a script that creates an online application, log-in, and start the PLC as shown in the below function code.
def plc_start():
onlineapp = online.create_online_application(None)
onlineapp.login(0,True)
plc_login()
onlineapp.start()
print("started")
To stop the plc while staying logged in, I need to use the <onlineapp>.stop(). The problem is that I'm not able to keep the declaration of the <onlineapp> to a next run of the script. So, I want to "ask the scriptEngine what online application is existing now"? How could I program for this question knowing that there is nothing as <active_online_application> in the scriptEngine help?</active_online_application></onlineapp></onlineapp>
BR,
Halim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Halim hat geschrieben:
To stop the plc while staying logged in, I need to use the <onlineapp>.stop(). The problem is that I'm not able to keep the declaration of the <onlineapp> to a next run of the script. So, I want to "ask the scriptEngine what online application is existing now"? How could I program for this question knowing that there is nothing as <active_online_application> in the scriptEngine help?</active_online_application></onlineapp></onlineapp>
ScriptEngine has no need to remember which online application exists because it is not necessary. Just create a new online application and check if it is logged in. If not, login and stop the running app.
BR
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi.
I could manage to write a script that creates an online application, log-in, and start the PLC as shown in the below function code.
def plc_start():
onlineapp = online.create_online_application(None)
onlineapp.login(0,True)
plc_login()
onlineapp.start()
print("started")
To stop the plc while staying logged in, I need to use the <onlineapp>.stop(). The problem is that I'm not able to keep the declaration of the <onlineapp> to a next run of the script. So, I want to "ask the scriptEngine what online application is existing now"? How could I program for this question knowing that there is nothing as <active_online_application> in the scriptEngine help?</active_online_application></onlineapp></onlineapp>
BR,
Halim
Hi Halim.
ScriptEngine has no need to remember which online application exists because it is not necessary. Just create a new online application and check if it is logged in. If not, login and stop the running app.
BR
Martin