wincc-脚本实现跳转浏览器(webux)
文章目录
实现
Sub OnLButtonDown(Byval Item, Byval Flags, Byval x, Byval y)
'Dim CurrentUserName
'Dim UserName
'Set CurrentUserName = HMIRuntime.Tags("@CurrentUserName")
'
'If CurrentUserName.Read <> "" Then
' UserName=CurrentUserName.Value
'Else
' UserName="unknow"
'End If
Dim objHTTP,xmlDOC,strWebserviceURL,strRequest,bOK,xmlStr,result,resultData,sc
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
strWebserviceURL = "https://xxx/reToken"
strRequest=""
objHTTP.Open "GET", strWebserviceURL, False
objHTTP.Send(strRequest)
result =objHTTP.ResponseText
Set sc = CreateObject("MSScriptControl.ScriptControl")
sc.Language = "JScript"
sc.AddCode "var tmp = " & result & ";"
resultData = sc.Eval("tmp." & "data")
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "chrome.exe https://www.baidu.com?a=" + resultData
End Sub