Can you run a .bat file from a panelview HMI?!

96kingo

Member
Join Date
Jan 2012
Location
Rochester
Posts
16
Hi All

Does anyone know if its possible to run a .bat file stored on a panelview drive, via the HMI (maybe an active x control?)

Ive got a system which already runs the activex datastore to write to a file on the panelview, and have got a batch file that copies the file across to a USB Stick and deletes the remaining file. All i need to do is run this .bat file from within the designed HMI and the project is complete!

I have a panelview Plus 6 and factorytalk view studio.

Best Regards

Oliver King
 
The "Program Launcher" ActiveX control will do this.

There's an RA Knowledgebase document that describes the use of the DataStore, the Program Launcher, and a .BAT file together: ID# 58936 (TechConnect required).

The Program Launcher example I've used is also in the Knowledgebase, ID# 458918 (TechConnect not required).
 
I found the program launcher shortly after posting this, however i've had a look at the latter Knowledgebase document as I do not have TechConnect. Checked over my program, and it comes up with the error 'Failed to start \files\getdata.bat'
Do I have to open a separate program before opening the bat file as you do when opening a pdf?

Oliver
 
Update:
I have got the cmd.exe to open first in the program location option in the activex, then put my .bat file path in the program parameters option. This brings up an error of 'Unrecognised option \file path' and closes cmd.
If i literally type the path into cmd on its own, it runs no problem.
 
Its amazing what a bit of tinckering can do!
Ive solved the problem, it was because i was trying to run the file path directly, so i just put a /C in : '/C \filepath' and works a treat!
 
I'm having issues with this same problem now. I made a .bat file that I converted to a .exe file using Iexpress. Clicking on the .exe works fine but placing the filepath in program launcher does nothing. Literally, when I press the button that changes the tag's state, FTView does not give me an error message or proceed to execute the .exe.
 
Are you attempting to run this on a PanelView Plus, or on a Windows computer ?

The hardest part about the Program Launcher ActiveX is getting the exact syntax correct. If you can post a screenshot of the literal strings or the String-type HMI Tags you are using, folks can have a look.

One helpful think I've done is to add a FactoryTalk diagnostic banner to my test Display to see if there are any system messages when you press the button.
 
Here's a pic. Only thing not in the pic is that '123' tag is connected to a momentary pushbutton.

Also, it's a little blurry but the destination I have in ProgramLocation is:

"C:\ab.exe"


EDIT: Not sure if it matters but the only thing I have in the .bat / .exe file is a shutdown PC command

pic.jpg
 
I just tried what you showed, but with just a batch file named "ab.bat" that contained only the command "shutdown -s".

Sure enough, the computer shut down when I clicked the pushbutton that set the trigger tag.

I can't explain exactly what's going on, then, on your PC.

Mine is running Windows XP SP3 (in a VMWare 7 virtual machine) with FactoryTalk View Studio 6.10. This was in Test Display mode in FactoryTalk View Studio.
 
Did you use a .exe or just set the ProgramLocation for the .bat file? I have Windows 7 on an Allen-Bradley 1700P Touch screen. Am I missing a property in the Program Launcher?

EDIT: Replaced my ProgramLocation with the Adobe reader... No problem opening that up.
 
Last edited:
Now when I do that, I get a cmd popup that disappears instantly. Hitting the button enough I can make out that:

'shutdown' is not recognized as an internal or external command, operable program or batch file.

Opening up my ab.bat the only text I have is:

shutdown -s
 
Last edited:
Add a 'pause' to the batch file and the CMD window will wait for you to press a key.

Is this a full Windows 7 Professional installation, or some variation of Windows Embedded ?

I recently worked on a machine that had Windows Embedded 2009 installed (essentially XP Professional) but the person building the OS had left off a surprising number of features. In my case this included the command-line IPCONFIG, which meant I had to attach a mouse and click through menus just to check the IP status.

It's very interesting that you say the EXE works when you just click on it.

Maybe it's a problem with the context; when you click on it you're using your own permissions, but when FTView executes the file it's using different permissions.
 
Finally got it to work! I looked further into the path to shutdown.exe since it wasn't being found. Not sure why my computer could find the path but apparently FTView couldn't. My working .bat file looks like:

cd windows
cd system32
shutdown.exe -s -t 0

Thanks for all the help Ken.
 

Similar Topics

Hello Guys. I've tried to get my WinCC Flexible RT to run a .bat script on my pc that i've made. But i can't get the RT to run my script when...
Replies
0
Views
2,304
Hello..I am new to Plc.I have Mitsubishi Melsec Fx3Ga-40MR PLC controlling a machine for packing powder.Currently the Plc has issue which power...
Replies
3
Views
75
I'm looking to get some spare keys for this PLC. Does anyone know a source or have a part number? My searches are turning up nothing at the moment.
Replies
1
Views
66
I have a few questions about Studio5000. 1. Why is my RA folder so big? its well over 100 GB. 2. How do you delete versions or extra files...
Replies
3
Views
273
Hello The plant is running and there is no shutdown nowadays therefore I can add 1734- AENTR and its card while PLC is in Run? I do not wanna...
Replies
8
Views
343
Back
Top Bottom