AdvancedHMI Software

General Category => Support Questions => Topic started by: Aparajit on June 18, 2021, 07:50:35 PM

Title: Use of Advanced HMI button to start a batch file
Post by: Aparajit 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,
Title: Re: Use of Advanced HMI button to start a batch file
Post by: MajorFault on June 18, 2021, 08:35:30 PM
It's .Net so yes. Search the web and you will get tons of info.
Title: Re: Use of Advanced HMI button to start a batch file
Post by: dmroeder 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)
Title: Re: Use of Advanced HMI button to start a batch file
Post by: Aparajit 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)?
Title: Re: Use of Advanced HMI button to start a batch file
Post by: MajorFault 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.
Title: Re: Use of Advanced HMI button to start a batch file
Post by: dmroeder 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.