about SetPromptResultText ()

about SetPromptResultText ()

zhikaobi1725
Contributor Contributor
2,031 Views
3 Replies
Message 1 of 4

about SetPromptResultText ()

zhikaobi1725
Contributor
Contributor

I am  a new in  inventor  API : Now, I have a question to ask . thanks for lots first

 I use one code  downloaded form this forum to learn . as following

 when the code run to  oTitleBlock.SetPromptResultText (oTextBox,"HELLO WORLD!!!")   a  error   happens

 showing"Conpile error: syntax error"  

I downloaded orthers code with the funtion  SetPromptResultText() ,a  same question happens

My  inventor ver. is < inventor  professional 2015>,  Could  any  specilist   tell me? WHY?

 

 

 

Sub title()

 Dim oSheet As Sheet
 Dim oTitleBlock As TitleBlock
 Dim oTextBox As TextBox
 Dim oTextBoxes As TextBoxes

 Set oSheet = ThisApplication.ActiveDocument.ActiveSheet

 If oSheet.TitleBlock Is Nothing Then Exit Sub

 Set oTitleBlock = oSheet.TitleBlock

 If oTitleBlock.Definition.Sketch.TextBoxes Is Nothing Then Exit Sub

 Set oTextBoxes = oTitleBlock.Definition.Sketch.TextBoxes

 For Each oTextBox In oTextBoxes
  If oTextBox.Text = "MYPROMPTEDTEXT" Then Exit For
 If oTextBox Is Nothing Or oTextBox.Text <> "MYPROMPTEDTEXT" Then
 oTitleBlock.SetPromptResultText (oTextBox,"HELLO WORLD!!!")

 End If
 End If
 Next
End Sub

 

0 Likes
Accepted solutions (1)
2,032 Views
3 Replies
Replies (3)
Message 2 of 4

JaneFan
Autodesk
Autodesk

Hey @zhikaobi1725

 

Thank you for your reporting. This seems an API issue to me. I will get it logged in our internal system. 




Jane Fan
Inventor/Fusion QA Engineer
Message 3 of 4

zhikaobi1725
Contributor
Contributor

Dear JaneFan:

 Thank you for your answer about this question at first time

Let me know when you have a correct solution.

 

0 Likes
Message 4 of 4

JaneFan
Autodesk
Autodesk
Accepted solution

Hey @zhikaobi1725,

 

Sorry for misleading. SetPromptResultText  can only be used on the TextBox whose format meets some certain format. Please add following judgment to your code:

 If InStr(1, oTextBox.FormattedText, "<Prompt ") = 1 Then
    Call oTitleBlock.SetPromptResultText(oTextBox, "test")
End If




Jane Fan
Inventor/Fusion QA Engineer