You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old April 13th, 2018, 02:33 PM   #1
healey_bruno
Member
Canada

healey_bruno is offline
 
Join Date: Apr 2008
Location: Montreal
Posts: 4
Changing a windows document name from a PLC

Hi!
I would like to rename a document (pdf) in Windows with a variable from my PLC. I'm using a CompactLogix PLC with FactoryTalk View ME.

FactoryTalk view ME run on an industrial PC with Windows 7 pro.
There are some pdf automaticaly created on this PC and I would like to rename them after a variable from my compactlogix.

Does anybody know a way of doing this?

Thanks!!
  Reply With Quote
Old April 15th, 2018, 05:36 PM   #2
ASF
Lifetime Supporting Member
Australia

ASF is offline
 
Join Date: Jun 2012
Location: Australia
Posts: 2,634
That's a fun question.

Do you have an RSLinx Gateway license, and Microsoft Excel? If so, you could write some VBA:

1. Use the DDE method to read a certain tag from the PLC into excel
2. Rename the file with the contents of that tag you just read

If you don't have either of those things, it's still possible. You'll just need to find a way to read the value from your PLC with some other sort of scripting. I believe user dmroeder has a python script that can read/write CompactLogix tags. I'm sure python can rename files as well.

A third option might be AdvancedHMI. It's free and if you have a reasonable handle on VBA, quite powerful. I currently have a setup at home that uses a windows batch file to retrieve a weather forecast text file from the weather bureau every hour. Shortly afterward, my AdvancedHMI application calls up that file, extracts relevant figures, and writes them into a Click Koyo PLC. Later, it grabs values from the PLC and logs them to a text file. It's not that far removed from what you're doing - I'm not renaming files per se, but the VBA to write a PLC tag value into a specified file is not that different from the VBA to rename a specified file with the tag value from a PLC.

Any of those options take your fancy?
  Reply With Quote
Old April 15th, 2018, 06:16 PM   #3
Ken Roach
Lifetime Supporting Member + Moderator
United States

Ken Roach is online now
 
Ken Roach's Avatar
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 14,091
Since you already have FactoryTalk View ME running, I would recommend using the ME Program Launcher ActiveX to run an ordinary batch file.

The hard part is to be sure you've got an ME Display always open that can host the ActiveX object. I use my navigation bar for that purpose in most cases, but it's easier because on the PV+ I can place objects offscreen that are still on the Display.
  Reply With Quote
Old April 15th, 2018, 08:27 PM   #4
ASF
Lifetime Supporting Member
Australia

ASF is offline
 
Join Date: Jun 2012
Location: Australia
Posts: 2,634
Even simpler again! I like it!
  Reply With Quote
Old April 16th, 2018, 10:30 AM   #5
healey_bruno
Member
Canada

healey_bruno is offline
 
Join Date: Apr 2008
Location: Montreal
Posts: 4
Thanks!

I never used a batch file, but I know what it is. From a script in a batch file, it would be possible to get a tag value from a PLC? and then rename this a file with that that value?
Thanks again!
  Reply With Quote
Old April 16th, 2018, 10:54 AM   #6
Dravik
Member
United States

Dravik is offline
 
Join Date: Jun 2008
Location: New York
Posts: 1,343
You would pass the tag value to the script as a parameter.
  Reply With Quote
Old April 16th, 2018, 11:52 AM   #7
Ken Roach
Lifetime Supporting Member + Moderator
United States

Ken Roach is online now
 
Ken Roach's Avatar
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 14,091
I have not done that, but in general you can pass a parameter to a Windows Batch file as a command-line argument.

https://en.wikibooks.org/wiki/Window...line_arguments
  Reply With Quote
Old April 16th, 2018, 12:22 PM   #8
healey_bruno
Member
Canada

healey_bruno is offline
 
Join Date: Apr 2008
Location: Montreal
Posts: 4
Thanks everyone!
I was able to do it with the ME Program Launcher.

ProgramLocation : "C:\BatchFile.bat"
ProgramParameter : "variable from the plc"
FocuseEnable:
LauchEnalbe : "variable from plc to lauch the bat file"


for my test my batch file was quite simple :

@echo off
rename C:\fileName.txt "%1".txt


Thats it!

Thanks again!
  Reply With Quote
Old April 17th, 2018, 12:19 AM   #9
ASF
Lifetime Supporting Member
Australia

ASF is offline
 
Join Date: Jun 2012
Location: Australia
Posts: 2,634
Thanks for sharing the solution! Nice and neat, I like it!
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Changing the PLC IP address from an HMI kriskizlyk LIVE PLC Questions And Answers 1 April 5th, 2016 03:08 PM
Im totally new! Please help! Tool changer PLC mike^3 LIVE PLC Questions And Answers 34 November 3rd, 2015 03:28 PM
PLC Advice - Home Automation Needs onefineday2010 LIVE PLC Questions And Answers 10 July 31st, 2015 09:43 AM
Accessing S5-135U PLC with HP laptop having WINDOWS XP Professional RAJATPALLAV LIVE PLC Questions And Answers 7 August 1st, 2007 07:05 AM
Flying windows button for RSView32 security Deer LIVE PLC Questions And Answers 6 February 4th, 2004 10:12 AM


All times are GMT -5. The time now is 10:49 PM.


.