Author Topic: Use of Advanced HMI button to start a batch file  (Read 1700 times)

Aparajit

  • Newbie
  • *
  • Posts: 6
    • View Profile
Use of Advanced HMI button to start a batch file
« on: June 18, 2021, 07:50:35 PM »
Just wondering, whether I can use Advanced HMI in non PLC environment, executing a program, start a file etc.

Regards,

MajorFault

  • Guest
Re: Use of Advanced HMI button to start a batch file
« Reply #1 on: June 18, 2021, 08:35:30 PM »
It's .Net so yes. Search the web and you will get tons of info.

dmroeder

  • Administrator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Use of Advanced HMI button to start a batch file
« Reply #2 on: June 19, 2021, 08:21:01 PM »
Just wondering, whether I can use Advanced HMI in non PLC environment, executing a program, start a file etc.

Regards,

Process.Start(pathToBatchFile)

Aparajit

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Use of Advanced HMI button to start a batch file
« Reply #3 on: June 23, 2021, 08:26:18 PM »
Thanks dmroeder! As I look at the property of the button, for address_click, normally I give reference to the bit address. Where do I write the code, Process.Start (file path)?

MajorFault

  • Guest
Re: Use of Advanced HMI button to start a batch file
« Reply #4 on: June 23, 2021, 10:42:40 PM »
Just use a regular button. Drag and drop, double click and it will bring up the code.

dmroeder

  • Administrator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Use of Advanced HMI button to start a batch file
« Reply #5 on: June 24, 2021, 10:17:07 AM »
Thanks dmroeder! As I look at the property of the button, for address_click, normally I give reference to the bit address. Where do I write the code, Process.Start (file path)?

Yeah sorry, I should have been more specific.  As @MajorFault said, double click the button, this will will bring you to the code editor, specifically, the button click event.  Put the code I mentioned in there.  The "PathToBatchFile" is obviously the windows path to your file "C:\MyBatchFile.bat", process.start accepts a string, so the path will need quotes around it.