<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: iLogic - &amp;quot;save as&amp;quot; pop-up box in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9639131#M113354</link>
    <description>&lt;P&gt;You either need to include an "\" in the path you supply within the Form, or within the oPath variable in the code, for this to work.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jul 2020 14:09:41 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2020-07-16T14:09:41Z</dc:date>
    <item>
      <title>iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638396#M113314</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;How can I force iLogic to force the save-as pop-up box (as if I'm pressing CTRL+S). Can I make it do something like&lt;/P&gt;&lt;LI-CODE lang="general"&gt;MessageBox.Show("Save now?",, MessageBoxButtons.YesNo)
If vbYes Then
CTRL+S
End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have to make it wait until 'DONE' is pressed in Form box.&lt;/P&gt;&lt;P&gt;I've added a Screencast to show what I mean.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've reduced the length of the code, as some parts are only logic to create part.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'------ CREATE PART ------
iLogicForm.Show("Dimensions")
Feature.IsActive("Revolution1") = True
Feature.IsActive("Chamfer1") = True
Feature.IsActive("Chamfer2") = True

(Code that I've removed here)

'------- SAVE PART -------
' Save box should only come up after we've clicked DONE in FORM dialog box
'MessageBox.Show("File must be saved before making a drawing." &amp;amp; vbNewLine &amp;amp; vbNewLine &amp;amp; "Save now?", "Save part", MessageBoxButtons.YesNo)

'If vbYes Then
'ThisDoc.Document.SaveAs(NewFileNameAndExtension , True)

'End If&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 Jul 2020 07:36:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638396#M113314</guid>
      <dc:creator>ChristianAndersenIsmyname</dc:creator>
      <dc:date>2020-07-16T07:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638723#M113323</link>
      <description>&lt;P&gt;You could create a simple little iLogic rule, that only does the stuff after ---Save Part---, then drag that rule over into your form as a button.&amp;nbsp; Then you can eliminate the Done button, and only have the rule button.&amp;nbsp; Within the Form Editor, you can set the action to take when you click on that button.&amp;nbsp; You can set it to Apply then Run the rule.&amp;nbsp; That should do what you want.&lt;/P&gt;&lt;P&gt;You can use SendKeys to simulate pressing that keyboard keys combination too, instead of the ThisDoc.Document.SaveAs() method.&lt;/P&gt;&lt;P&gt;You could also execute the command behind the Control+S shortcut.&lt;/P&gt;&lt;P&gt;(AppFileSaveAsCmd)&lt;/P&gt;&lt;P&gt;(AppFileSaveCmd)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 11:00:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638723#M113323</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-07-16T11:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638744#M113324</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With creating an add-in i.e. Vb.net you have a BeforeSave Or AfterSave Event.&lt;/P&gt;
&lt;P&gt;But that is not what you need, correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 11:07:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638744#M113324</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2020-07-16T11:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638762#M113325</link>
      <description>&lt;P&gt;That's a good idea that I didnt know about. Thanks.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristianAndersenIsmyname_0-1594898114186.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/795978iAE1F99D59EB66B31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristianAndersenIsmyname_0-1594898114186.png" alt="ChristianAndersenIsmyname_0-1594898114186.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, what code am I gonna enter in this Rule?&lt;/P&gt;&lt;P&gt;It seems like a simple task if the file has already been saved before, but a bit more tricky when its a new part?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 11:17:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638762#M113325</guid>
      <dc:creator>ChristianAndersenIsmyname</dc:creator>
      <dc:date>2020-07-16T11:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638781#M113329</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oSave As MsgBoxResult =  MsgBox("File must be saved before making a drawing." &amp;amp; vbCrLf &amp;amp; _
"Save now?", vbYesNo + vbQuestion, "SAVE?")

If oSave = vbYes Then
	ThisApplication.CommandManager.ControlDefinitions.Item(AppFileSaveAsCmd).Execute
End If&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 Jul 2020 11:30:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638781#M113329</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-07-16T11:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638794#M113330</link>
      <description>&lt;P&gt;Getting a error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Error in rule: Save file, in document: Part23

Feil parameter. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))


System.ArgumentException: Feil parameter. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)
   at Inventor.ControlDefinitions.get_Item(Object Index)
   at ThisRule.Main()
   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Side note: Since this is a new part, should be able to enter desired file name and save location (path).&lt;/P&gt;&lt;P&gt;So if I'm able to something like picture below, that would be awesome.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristianAndersenIsmyname_0-1594899216115.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/795983i4FA18495894F3907/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristianAndersenIsmyname_0-1594899216115.png" alt="ChristianAndersenIsmyname_0-1594899216115.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 11:37:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638794#M113330</guid>
      <dc:creator>ChristianAndersenIsmyname</dc:creator>
      <dc:date>2020-07-16T11:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638842#M113333</link>
      <description>&lt;P&gt;I found a similar post: &lt;A href="https://forums.autodesk.com/t5/inventor-customization/ilogic-save-as-rule/td-p/6421308" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/ilogic-save-as-rule/td-p/6421308&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I want mostly the same as this, but I also want to be able to set save location (preferably in the same box as Forms).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've therefore added two custom properties.&lt;/P&gt;&lt;P&gt;Custom Property: File Name&lt;/P&gt;&lt;P&gt;Custom Property: Save Location&lt;/P&gt;&lt;P&gt;I've added these two to Forms, so its easy to fill out, but how can I adjust this code to read those values?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Inventor.Document = ThisApplication.ActiveDocument
Dim FName As String = oDoc.FullFileName
Dim FNP As Integer = InStrRev(FName, "\", -1)
Dim oPath As String = Left(FName, FNP)
Dim oNewName As String = InputBox("Enter New File Name", "Save as", "Name")

' If the user closes the input box, then stop the function
If oNewName = vbNullString Then Exit Sub

Dim oType As String
Select Case oDoc.DocumentType
Case kPartDocumentObject:     oType = ".ipt"
Case kAssemblyDocumentObject: oType = ".iam"
Case kDrawingDocumentObject:  oType = ".idw"
End Select

oDoc.SaveAs(oPath &amp;amp; oNewName &amp;amp; oType, True)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 Jul 2020 12:04:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638842#M113333</guid>
      <dc:creator>ChristianAndersenIsmyname</dc:creator>
      <dc:date>2020-07-16T12:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638844#M113334</link>
      <description>&lt;P&gt;I forgot to enclose the name of the command in Quote marks.&amp;nbsp; It should be like this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oSave As MsgBoxResult =  MsgBox("File must be saved before making a drawing." &amp;amp; vbCrLf &amp;amp; _
"Save now?", vbYesNo + vbQuestion, "SAVE?")

If oSave = vbYes Then
	ThisApplication.CommandManager.ControlDefinitions.Item("AppFileSaveAsCmd").Execute
End If&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 Jul 2020 12:05:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638844#M113334</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-07-16T12:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638881#M113337</link>
      <description>&lt;P&gt;Is this what you want?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Inventor.Document = ThisApplication.ActiveDocument
Dim oCProps As PropertySet = oDoc.PropertySets.Item("Inventor User Defined Properties")
Try
	Dim oFileName As String = oCProps.Item("File Name").Value
	Dim oPath As String = oCProps.Item("Save Location").Value
	Dim oType As String = ".ipt"
	oDoc.SaveAs(oPath &amp;amp; oFileName &amp;amp; oType, True)
Catch oEx As Exception
	MsgBox("The SaveAs Sub failed." &amp;amp; vbCrLf &amp;amp; _
	"The error message is as follows:" &amp;amp; vbCrLf &amp;amp; _
	oEx.Message, vbOKOnly + vbExclamation, "SaveAs Error")
End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 12:27:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9638881#M113337</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-07-16T12:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9639113#M113351</link>
      <description>&lt;P&gt;I used your code now, and it's still not doing as it's supposed to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Picture below is showing that I've entered File Name and Save Location in the Form box.&lt;/P&gt;&lt;P&gt;After everything is filled out, I press Save File (which runs the Rule from your previous post).&lt;/P&gt;&lt;P&gt;iProperties are saying the file is "Not Saved".&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristianAndersenIsmyname_1-1594907906834.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/796047i8EF7D14434878C46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristianAndersenIsmyname_1-1594907906834.png" alt="ChristianAndersenIsmyname_1-1594907906834.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 14:02:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9639113#M113351</guid>
      <dc:creator>ChristianAndersenIsmyname</dc:creator>
      <dc:date>2020-07-16T14:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9639124#M113353</link>
      <description>&lt;P&gt;The path needs an additional "\"&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 14:07:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9639124#M113353</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2020-07-16T14:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9639131#M113354</link>
      <description>&lt;P&gt;You either need to include an "\" in the path you supply within the Form, or within the oPath variable in the code, for this to work.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 14:09:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9639131#M113354</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-07-16T14:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic - "save as" pop-up box</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9639174#M113357</link>
      <description>&lt;P&gt;Thank you! This worked &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@F982DDE76110C67DBDB6AF220B48480A/emoticons/1f604.png" alt=":grinning_face_with_smiling_eyes:" title=":grinning_face_with_smiling_eyes:" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 14:27:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-quot-save-as-quot-pop-up-box/m-p/9639174#M113357</guid>
      <dc:creator>ChristianAndersenIsmyname</dc:creator>
      <dc:date>2020-07-16T14:27:09Z</dc:date>
    </item>
  </channel>
</rss>

