dchlmz 发表于 2005-11-14 10:32:00

请问如何在命令行交互输入字符串?

请问如何在命令行交互输入字符串?我想对某一层进行操作,用"Getstring",输入层名时总是出错。

sieben 发表于 2005-11-14 16:49:00

<PRE class=Code>Utility.GetString</PRE><PRE class=Code>AutoCAD里有帮助</PRE><PRE class=Code>Sub Example_GetString()
    ' This example demonstrates different ways of returning a string
    ' entered by a user.
   
    Dim returnString As String
   
    ' Prompt &amp; Input cannot contain blanks
    returnString = ThisDrawing.Utility.GetString(False, "Enter text (a space or &lt;enter&gt; terminates input): ")
    MsgBox "The string entered was '" &amp; returnString &amp; "'", , "GetString Example"
   
    ' Prompt &amp; Input can contain blanks
    returnString = ThisDrawing.Utility.GetString(True, "Enter text (&lt;enter&gt; terminates input):")
    MsgBox "The string entered was '" &amp; returnString &amp; "'", , "GetString Example"
   
    ' Prompt &amp; Input can contain blanks, but not an empty string
    Dim NoNull As Integer
    NoNull = 1    ' Disallow null
    ThisDrawing.Utility.InitializeUserInput NoNull
    returnString = ThisDrawing.Utility.GetString(True, "Enter text (&lt;enter&gt; terminates input): ")
    MsgBox "The string entered was '" &amp; returnString &amp; "'", , "GetString Example"

End Sub</PRE>

dchlmz 发表于 2005-11-15 13:22:00

谢谢
页: [1]
查看完整版本: 请问如何在命令行交互输入字符串?