Windows脚本编程基础与实用技巧
1. 消息框与图标应用
在脚本编程中,消息框是与用户交互的重要工具。通过为消息框添加图标,可以增强视觉效果,为用户提供更直观的反馈。以下是一个带有图标的消息框示例代码:
strMsg="The file already exists. Do you want to overwrite it?"
strTitle="File Confirm"
rc=MsgBox(strMsg,vbYesNoCancel+vbQuestion,strTitle)
'take next steps based on value returned by
'MsgBox Function
Select Case rc
Case vbYes
MsgBox "Overwriting file",vbOKOnly+vbInformation,strTitle
'insert code here
Case vbNo
strNewName=InputBox("Enter a new filename.",_
strTitle,"c:\logs\newlog.txt")
'insert code here
Case vbCancel
MsgBox "Aborting the script",vbOKOnly+vbCritical,strTitle
WScript.Quit
End Select
'script continues
这个示例中,消息框会询问用户是否要覆盖已存在的文件,并根据用户
超级会员免费看
订阅专栏 解锁全文
2009

被折叠的 条评论
为什么被折叠?



