10 posts in this topic

Hello All,

I am using Wonderware InTouch 10.0 on Windows 7. It's slightly outdated, but its what we have. I am currently writing a script using the StartApp command to open a particular PDF file with the touch of a button. My script looks like StartApp("C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32 C:\1.pdf"); The first part of the command runs adobe and the second part of the command opens the particular file "1". What I need to figure out is, how do I insert a variable into a string. For example I have 55 files I may potentially need to open up, all named 1-55. So I need the file I am calling to be a variable inside of the string so I can call it inside of a loop. I do not want to copy and paste this code 55 times, I want to make the file name a variable (tagname that is a memory real between 1 and 55) so I can run it in a loop. I have only been using Wonderware for a month or so now, so If anything is confusing feel free to ask. Thanks!

Share this post


Link to post
Share on other sites

You want to write one script with an index variable that can be changed so that your one script can open 1-55 files => indirect adressed script

InTouch's scripting for the StartApp function includes " quotes at beginning and end of the string.  I believe the semi-colon indicates the end of the statement.  Thus, you should be able to include the document indirect register within the script.

You will need a register tag for the indexer pointer, what is going to change from 1-55.  Lets call it POINTER.VALUE.

StartApp("C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32 C:\"POINTER.VALUE"1.pdf");

https://okmgcs.km.invensys.com/gcs/index?page=content&id=TN584&pmv=print&impressions=false&viewlocale=

http://platforma.astor.com.pl/files/getfile/id/3887

 

Share this post


Link to post
Share on other sites

Yes, this is exactly what I want to do. Whenever I do this, I get an error saying "expecting right parenthesis" I think this is because of the additional parenthesis surrounding the tagname "POINTER.VALUE". Is anyone aware of what single do ' ' ?   

Share this post


Link to post
Share on other sites

Kaiser_Will, thank you for you quick response by the way. I am still learning Wonderware at the moment, but I think the problem I am having is that I do not know how to get the StartApp function to recognize my taganme as a tagname. But then if I did get it to recognize my taganme, what should my tagname be? it only needs to be stored locally, but It shouldn't be an integer, should it? It should be a string value?

Share this post


Link to post
Share on other sites

The new tag will be local and integer.  Post a screenshot of your tag creation and the script code.

Share this post


Link to post
Share on other sites

Test is simply the button I am using to start the function, I am resetting it back to Zero because I don't want it to pull up multiple windows if the operator holds a finger on the button for longer than 500ms.

Share this post


Link to post
Share on other sites

There are 2 things that could be the issue: StartApp statement has two sets of parantheses and Does StartApp know where these files are located.

Do you have a space between the C-drive location of Adobe Acrobat and the file name/location?  https://insource.mindtouch.us/Support_Tickets/InTouch/Scripting/029264_-_How_to_launch_a_PDF_file_from_intouch

https://www.logic-control.com/datasheets/1/InTouch/ITScriptsAndLogic.pdf

Share this post


Link to post
Share on other sites

StartApp only knows where the files are when I give it a path to follow. I do not have any spaces. This code works for opening one file, it just doesn't work when I try to put a variable as part of the path.  

Share this post


Link to post
Share on other sites

just signed up for this site. I am a little new to wonderware . I have been able to purchase development license for v9 with the runtime license also. I also have v10.0 and v10.1 and just recently I  acquired v2012 with a development license. I have been trying to find a runtime license for v10.0.or 10.1. but so far I have not found one. a new runtime is about 4k dollars. I am a retired support technician. now I do some phone support and some small intergration work. does anyone out there have a runtime license to swap or trade for something that they  need for traning. I have a large inventory  that myself and friends have used to train and move on in the automation field. we all at one time want to learn and get better at what we do and some times we cannot because of the cost to learn. I have helped many to do this, so I hope no one takes offense at this request  Thanks Rick

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now