VB Script in MP270B, little help needed

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
Hi

I made 2 I/O fields and I connected Tag_1 and Tag_2

Then I wrote this in Script_1:

Dim Mitsu = Int
Dim S7 = Int
Mitsu = SmartTags("Tag_1")
S7 = SmartTags("Tag_2")
Mitsu = S7

I want the value of Tag_1 connected with the value of Tag_2.

I'm doing this because I have 2 connections on this panel, one to a mitsubishi and one to and S7. So I want a connection between the PLC's of 1 tag via the panel.

But the code doesn't work, for you vb script spcialists, this must be easy ?? I don't know anything about scripting, this is the first I'm writing

greets
 
script

IN MP370



Step1



Create a tag s7 (internal tag of type UInt)

Also create another tag mitsu of same type





Step2

Go to scripts and make a script named “s72mitsu”

In the name field in the properties of this script type “s72mitsu”

Under type filed select Function

Lastly in parameter field type “s7” and press ADD button



Under script body u just need to write

S72mitsu=s7



Step3

Go to properties of s7 tag

Under event CHANGE VALUE select the script s72mitsu



Step4

In any screen make two IO fields

To one field attach the tag s7 (input)and to other IO filed attach the tag mitsu(output)



You are done
 
Not sure.

Maybe try to change

Mitsu = S7

to

SmartTags("Tag_1") := S7

edit: Actually it is a good question.
"How to write values to the connected PLC via Scripts".
If manmeetvirdi's code work, then it could be easy.
 
Last edited:
Step3(step 3 procedure in last post was incomplete)

Go to properties of s7 tag

Under event CHANGE VALUE select the script s72mitsu



Outputvalue-->mitsu(tag)

s7-->s7 (tag)

 

Similar Topics

Hello, I am learning to create shapes and VB Scripts in HMIWeb Display Builder. I wanted to change color of my rounded rectangle by script. I...
Replies
0
Views
104
Hello, I have a quick question. I have been using scripts to change the color of buttons. The reason, I am usually using multiple hmiruntime.tags...
Replies
1
Views
100
Hi All, I'm keep getting double quotes in between selections rather than the beginning and the end. Here's the script and please help to find...
Replies
7
Views
800
Dear guys, I am not a programmer but I can do simple things myself. I'm stuck with the following. if I want to extract a value from my rx3i...
Replies
46
Views
4,763
Hi guys, I'm busy on the migration of old 3G/RS232 modems to 4-5G / Ethernet modems on about 200 pumping stations across the country. To...
Replies
0
Views
438
Back
Top Bottom