设为首页 收藏本站
查看: 567|回复: 0

PowerShell Popup Method

[复制链接]

尚未签到

发表于 2017-5-20 06:21:29 | 显示全部楼层 |阅读模式
Popup Method

1 out of 1 rated this helpful-
Rate this topic
  Updated: September 2010
  Displays text in a pop-up message box.





Copy



                      intButton = object.Popup(strText,[nSecondsToWait],[strTitle],[nType])











Arguments







object
  WshShell object.


strText
  String value that contains the text you want to appear in the pop-up message box.


nSecondsToWait
  Optional. Numeric value indicating the maximum number of seconds you want the pop-up message box displayed. IfnSecondsToWait is zero (the default), the pop-up message box remains visible until closed by the user.


strTitle
  Optional. String value that contains the text you want to appear as the title of the pop-up message box.


nType
  Optional. Numeric value indicating the type of buttons and icons you want in the pop-up message box. These determine how the message box is used.


intButton
  Integer value indicating the number of the button the user clicked to dismiss the message box. This is the value returned by thePopup method.





Remarks






  The Popup method displays a message box regardless of which host executable file is running (WScript.exe or CScript.exe).
  If nSecondsToWait equals zero (the default), the pop-up message box remains visible until closed by the user. IfnSecondsToWaitis is greater than zero, the pop-up message box closes afternSecondsToWait
seconds.
  If you do not supply the argument strTitle, the title of the pop-up message box defaults to "Windows Script Host."

Type Parameter
  The meaning of the nType parameter is the same as it is in the Microsoft Win32 APIMessageBox function. The following tables show the values and their meanings. You can add values in these tables to combine
them.

Button Types

  Decimal value
  Hexadecimal value
  Description



  0


  0x0


  Show OK button.




  1


  0x1


  Show OK and Cancel buttons.




  2


  0x2


  Show Abort, Retry, and
Ignore buttons.




  3


  0x3


  Show Yes, No, and
Cancel buttons.




  4


  0x4


  Show Yes and No buttons.




  5


  0x5


  Show Retry and Cancel buttons.




  6


  0x6


  Show Cancel, Try Again, andContinue buttons.





Icon Types

  Decimal value
  Hexadecimal value
  Description



  16


  0x10


  Show "Stop Mark" icon.




  32


  0x20


  Show "Question Mark" icon.




  48


  0x30


  Show "Exclamation Mark" icon.




  64


  0x40


  Show "Information Mark" icon.





Other Type Values

  Decimal value
  Hexadecimal value
  Description



  256


  0x100


  The second button is the default button.




  512


  0x200


  The third button is the default button.




  4096


  0x1000


  The message box is a system modal message box and appears in a topmost window.




  524288


  0x80000


  The text is right-justified.




  1048576


  0x100000


  The message and caption text display in right-to-left reading order, which is useful for some languages.




  The previous three tables do not cover all values for
nType. For more information, see
MessageBox Function.



Return Value
  The return value intButton is the number of the button that the user clicked, or is -1 if the message box timed out. The following table lists possible return values.



  Decimal value
  Description



  -1


  The user did not click a button before nSecondsToWait seconds elapsed.




  1


  OK button




  2


  Cancel button




  3


  Abort button




  4


  Retry button




  5


  Ignore button




  6


  Yes button




  7


  No button




  10


  Try Again button




  11


  Continue button







Example :

# Popup the message

# intButton = object.Popup(strText,[nSecondsToWait],[strTitle],[nType])

$a = new-object -comobject wscript.shell

$intAnswer = $a.popup("Do you ?", 0, "Delete", 4)

if($intAnswer -eq 6)

{

$a.popup("yes")

}

else

{

$a.popup("no")

}

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-379165-1-1.html 上篇帖子: PowerShell基础教程(18)——使用 Windows PowerShell 执行管理任务 下篇帖子: powershell 常用命令
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表