Python script for stopping a running online application

Halim
2019-08-01
2019-08-06
  • Halim

    Halim - 2019-08-01

    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

     
  • mkeller

    mkeller - 2019-08-06

    Hi Halim.

    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

     

Log in to post a comment.