plc.myforum.ro Forum Index plc.myforum.ro
PLCs users www.plc.myforum.ro!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help.its about mouse click script get tag name.Intouch 2017

 
Post new topic   Reply to topic    plc.myforum.ro Forum Index -> ROther HMI
View previous topic :: View next topic  
Author Message
ngcgba
Junior
Junior


Joined: 07 Mar 2019
Posts: 11

PostPosted: 28/04/2019 13:03    Post subject: Help.its about mouse click script get tag name.Intouch 2017 Reply with quote

Hi, I use Intouch 2017. I need a script to do this:I have more 200 tags in the screen.I want to have a General script for 200 tags mouse right click event.
But how to know which one tag was mouse right click?
For example , in VB, i can use ActiveControl.Name.
Thanks.


Last edited by ngcgba on 29/04/2019 10:34; edited 1 time in total
Back to top
View user's profile Send private message
abddeeg
Junior
Junior


Joined: 28 Apr 2019
Posts: 2

PostPosted: 28/04/2019 16:38    Post subject: Reply with quote

With the "GetLinkedVariable()" function you read the name of the tag that is linked to an object property. The tag name returned by the "GetLinkedVariable()" function is checked. Once the check has been completed successfully you can then further process the tag name in the application-specific subprogram according to your requirements, read and write WinCC tags, and set other object properties.

Example:
Example for reading the name of a tag that is linked to the object property "OutputValue" of an IO field.
Code:

   

{
char* pszVarName = NULL;
char szVarName[_MAX_PATH+1];

//
//Read tag name of a direct connection
//
pszVarName = GetLinkedVariable(lpszPictureName,lpszObjectName,"OutputValue");

//
//Check return value
//
if (strlen(pszVarName) <0>= sizeof (szVarName)){
printf("Error: the C tag occupies too little memory to be able to accept the complete tag name\r\n");

}
else{
strncpy(szVarName,pszVarName,sizeof (szVarName));
printf("Info: szVarName=\"%s\" value=%f\r\n", szVarName, value);
//============================================
//
//User-specific subprogram
//
//============================================
//At this point you can program your
//application-specific code

}
}


Parameter of the function GetLinkedVariable:

lpszPictureName: Pointer to the active image
lpszObjectName: Pointer to the active object
"OutputValue": Name of the object property, to which the tag is linked.
Program flow:

The return value of the function GetLinkedVariable in pszVarName is stored intermediately.
As the function GetLinkedVariable does not return a NULL pointer, strlen is used to check if a value has been read.
If a valid value has been returned, the return value is copied into szVarName. There can be saved as a maximum _MAX_PATH characters.
Running userdefined code to process return value.
Notes on Triggering:
In process pictures you should avoid actions with cyclic triggers, because these might lead to a greater loading of the system. You should use variable triggers if possible.
When using variable triggers please make sure that when connecting the user object with the process variables the trigger for triggering the C action is also changed accordingly.
Back to top
View user's profile Send private message
abddeeg
Junior
Junior


Joined: 28 Apr 2019
Posts: 2

PostPosted: 28/04/2019 16:45    Post subject: Reply with quote

By changing a value of a tag (HMI_Tag_1), a script will be called and increment the value of a second tag (HMI_Tag_2).
WinCC could call scripts triggered by time or by Tag change. It makes possible, for example, to call a script (indirectly) by a PLC command.

Configuration main steps:
Create a project.
Activate Global Script Runtime (WinCC Explorer → Project → Computer → Properties → Properties → Stratup)
Create two tags (“HMI_Tag_1” and “HMI_Tag_2” both as “Signed 16-bit value” - WinCC Explorer → Tag Management)
Create a Action (WinCC Explorer → Global Script → VBS Editor → Open → File → New → Action)

Create a script as follow:
Code:

Option Explicit

Function action

Dim aaa

Set aaa = HMIRuntime.Tags("HMI_Tag_2")

aaa.Read

aaa.Value = aaa.Value + 1

aaa.Write


End Function


Configure the action's trigger to “HMI_Tag_1” (Menu → Tools → info / trigger → tab trigger → select Ta → Add → Tag Name = “HMI_Tag_1”)
Create a Picture
Insert a I/O Field (Smart Objects).
Link the I/O Field with “HMI_Tag_1” (Right mouse click → Configuration Dialog → Tag = “HMI_Tag_1”)
Insert a I/O Field (Smart Objects).
Link the I/O Field with “HMI_Tag_2” (Right mouse click → Configuration Dialog → Tag = “HMI_Tag_2”)
Back to top
View user's profile Send private message
ngcgba
Junior
Junior


Joined: 07 Mar 2019
Posts: 11

PostPosted: 29/04/2019 10:36    Post subject: Reply with quote

Hi, thank you very much .But i cant find GetLinkedVariable()" function in scripts. I use intouch 2017
Back to top
View user's profile Send private message
yaqui
Member junior
Member junior


Joined: 30 Aug 2012
Posts: 54

PostPosted: 03/06/2019 00:55    Post subject: Reply with quote

ngcgba wrote:
Hi, thank you very much .But i cant find GetLinkedVariable()" function in scripts. I use intouch 2017


Hi
You can´t find it, because they are talking about WinCC :whistle:
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    plc.myforum.ro Forum Index -> ROther HMI All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Fa-ti si tu propriul forum GRATUIT, pe www.myforum.ro