Hide Table of Contents
PromptForStringOrKeyword Method (ICommandMessage)
Result as defined in dsPromptResultType_e

Displays the specified prompt, local keywords, and default string in the command window and gets the user's input.

.NET Syntax

Visual Basic (Declaration) 
Function PromptForStringOrKeyword( _
   bool IgnoreSpaces As System.Boolean, _
   const dsString& Prompt As System.String, _
   const dsString& ErrorMsg As System.String, _
   const dsStringArray& GlobalKeywordStrArray As System.Object, _
   const dsStringArray& LocalKeywordStrArray As System.Object, _
   long PromptInit As System.Integer, _
   const dsString& DefaultString As System.String, _
   dsString* Keyword As System.String, _
   dsString* ResultString As System.String _
) As dsPromptResultType_e
dsPromptResultType_e PromptForStringOrKeyword( 
   System.bool IgnoreSpaces,
   System.string Prompt,
   System.string ErrorMsg,
   System.object GlobalKeywordStrArray,
   System.object LocalKeywordStrArray,
   System.int PromptInit,
   System.string DefaultString,
   out System.string Keyword,
   out System.string ResultString
   IgnoreSpaces : Boolean,
   Prompt : String,
   ErrorMsg : String,
   GlobalKeywordStrArray : Array,
   LocalKeywordStrArray : Array,
   PromptInit : Number,
   DefaultString : String
) : {
   Keyword : String,
   ResultString : String,
   Result : String
COM native C++ 
HRESULT PromptForStringOrKeyword( 
   VARIANT_BOOL IgnoreSpaces,
   BSTR Prompt,
   BSTR ErrorMsg,
   VARIANT GlobalKeywordStrArray,
   VARIANT LocalKeywordStrArray,
   LONG PromptInit,
   BSTR DefaultString,
   BSTR* Keyword,
   BSTR* ResultString,
   dsPromptResultType_e* Result
DSRESULT PromptForStringOrKeyword( 
   bool IgnoreSpaces,
   const dsString& Prompt,
   const dsString& ErrorMsg,
   const dsStringArray& GlobalKeywordStrArray,
   const dsStringArray& LocalKeywordStrArray,
   long PromptInit,
   const dsString& DefaultString,
   dsString* Keyword,
   dsString* ResultString,
   dsPromptResultType_e* Result


True to ignore spaces, false to not
Text to display as the prompt in the command window
Error message to display in the command window when the user input is invalid
Array of global keywords, which are typically language independent (see Remarks)
Array of local keywords, which are typically translated to the local language (see Remarks)
Prompt initialization as defined in dsPromptInit_e (see Remarks)
Default string to show at the prompt in the command window (see Remarks)
Keyword input by user
String input by user
Result[out] or Return Value
Result as defined in dsPromptResultType_e


Local keywords can be seen in the prompt in the command window during user interaction. Global keywords cannot be seen in the prompt in the command window. However, users can type global keywords at the prompt in the command window if they know them.

If the PromptInit parameter is set to:

  • dsPromptInit_e.dsPromptInit_NoDefault and a value is specified for DefaultValue, then the value is not used or displayed in the prompt in the command window.
  • dsPromptInit_e.UsePromptExplanation, then call ICommandMessage::PromptExplanation to specify the text for PromptInit.

See Also


DraftSight V1R4.0

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   PromptForStringOrKeyword Method (ICommandMessage)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2019 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.