调试脚本
🍋 创建调试脚本
脚本0.vbs
,将脚本放置在 home 路径下 ~/env/expeditionPCB/skill
内容如下
vb
Dim doc
Set doc = application.ActiveDocument
main
sub main()
If ValidateServer(doc) = 0 Then
msgbox "Server validation failed."
exit sub
End If
'// TODO Here
msgbox "hi~"
end sub
'#######################################################
'#######################################################
'#######################################################
' Function to validate document
Private Function ValidateServer(docObj)
Dim key, licenseServer, licenseToken
key = docObj.Validate(0)
Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")
licenseToken = licenseServer.GetToken(key)
Set licenseServer = nothing
'On Error Resume Next
Err.Clear
docObj.Validate(licenseToken)
If Err Then
ValidateServer = 0
Else
ValidateServer = 1
End If
End Function
🍋 使用
空格
弹框输入 0
即可执行此测试脚本
比如本案例回车后弹框如下