PowerShell Popup Method

來源:互聯網
上載者:User
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")
}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.