Powershell popup Method

Source: Internet
Author: 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

WshshellObject.

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 byPopupMethod.

Remarks

ThePopupMethod 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 APIMessageBoxFunction. 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

Zero x 100

The second button is the default button.

512

Zero X 200

The third button is the default button.

4096

Zero X 1000

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

524288

Zero X 80000

The text is right-justified.

1048576

Zero X 100000

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

The previous three tables do not cover all values
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 ")
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.