Vbscript 如果按下按钮,则启动文件
我一直在玩下面的脚本:Vbscript 如果按下按钮,则启动文件,vbscript,Vbscript,我一直在玩下面的脚本: Set WshShell = CreateObject("WScript.Shell") intButton = WshShell.Popup ("5 + 5 = 10 yes or no? if you answer correctly you win a prize!.",5, , 3 + 48) select case intButton case -1 strMessage = "You did not click any button wit
Set WshShell = CreateObject("WScript.Shell")
intButton = WshShell.Popup ("5 + 5 = 10 yes or no? if you answer correctly you win a prize!.",5, , 3 + 48)
select case intButton
case -1
strMessage = "You did not click any button within the 5 seconds allotted."
case 6
strMessage = "click ok to receive your prize!."
case 7
strMessage = "wrong no prize!."
case 2
strMessage = "ok see ya!."
end select
WshShell.Popup strMessage, , , 64
我希望它启动一个.gif文件,其中显示(单击“确定”以接收您的奖品)。我尝试在下面键入Wshshell.run“22.gif”
(单击“确定”以接收奖品),但它会同时启动“单击确定”框和gif
我如何才能让它仅在单击“确定”时启动.gif?键入时
strMessage = "click ok to receive your prize!."
Wshshell.run "22.gif"
您只需设置strMessage
变量来保存字符串,并在下面的行上显示gif
这是实际显示弹出消息的最后一行代码
WshShell.Popup strMessage, , , 64
快速解决方法是在每个案例中显示弹出窗口,如下所示
Set WshShell = CreateObject("WScript.Shell")
intButton = WshShell.Popup ("5 + 5 = 10 yes or no? if you answer correctly you win a prize!.",5, , 3 + 48)
select case intButton
case -1
strMessage = "You did not click any button within the 5 seconds allotted."
WshShell.Popup strMessage, , , 64
case 6
strMessage = "click ok to receive your prize!."
WshShell.Popup strMessage, , , 64
Wshshell.run "22.gif"
case 7
strMessage = "wrong no prize!."
WshShell.Popup strMessage, , , 64
case 2
strMessage = "ok see ya!."
WshShell.Popup strMessage, , , 64
end select
与您的问题没有直接关系,您可以直接在代码中嵌入Internet Explorer框架,以完全控制如何显示gif图像 取代
Wshshell.run "22.gif"
跟随并调整路径
Set objExplorer = CreateObject("InternetExplorer.Application")
With objExplorer
.Navigate "about:blank"
.Visible = 1
.Document.Title = "Show Image"
.Toolbar=False
.Statusbar=False
.Top=400
.Left=400
.Height=400
.Width=400
.Document.Body.InnerHTML = "<img src='C:\Users\Administrator\Desktop\22.gif'>"
End With
Set-objExplorer=CreateObject(“InternetExplorer.Application”)
使用objExplorer
.导航“关于:空白”
.Visible=1
.Document.Title=“显示图像”
.Toolbar=False
.Statusbar=错误
.Top=400
.左=400
.高度=400
.宽度=400
.Document.Body.InnerHTML=“”
以
不知道如何格式化文本基本上选择您的代码并按Ctrl-K(或单击编辑框上方的{}
按钮)。tnx Abdullah!谢谢你回答我的问题