功能是想实现只有在特定用户登录以后才显示一些相应按钮,比如管理员登录以后可以看到账户管理的按钮,从而进行账户管理。
但是现在是会出现以下错误,如图一:
并且在其他监控界面登录管理员账号的话,图二 上面红色圆圈中的按钮式不会出现的。只有在这隐藏该按钮的界面登录管理员账号,按钮才能显示。请教各位是什么问题。
代码如下:
if(strcmp(GetTagChar("@CurrentUserName"),"administrator")==0)
{
SetVisible("Login_out.pdl","Edit user",TRUE); //Return-Type: BOOL
printf("%s\r\r\n", "1");
}
else
{
SetVisible("Login_out.pdl","Edit user",FALSE); //Return-Type: BOOL
printf("%s\r\r\n", "0");
}
该C脚本是作为全局动作创建的,并且是在每次用户名变化时调用。
图片说明:
最佳答案
参考链接:《全局脚本如何启用,启用后如何调用》
http://www.ad.siemens.com.cn/service/answer/solution.aspx?Q_ID=78551&cid=1032
《vb全局动作脚本死机》
http://www.ad.siemens.com.cn/service/answer/solution.aspx?Q_ID=64230&cid=1032
《wincc全局脚本动作-------隐藏控件》
http://blog.sina.com.cn/s/blog_4aa3b77d010090nu.html
提问者对于答案的评价:
Picture not selected will show if scripts (in the pop-up) are still running and your pop-up is closed. Then the script tries to acces a prop that is not there anymore.
it''s a "feature".You can do nothing about it, only make sure you have not to much scripts running. The scripts are still running and your picture is closed already so can not find any objects in it.
这是后来在http://www.automation.siemens.com/WW/forum/guests/PostShow.aspx?PostID=317275&language=en
这里找到的答案~
没有办法~只能用内部变量做个桥梁了~
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc250945.html