<?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 Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) after SaveAs in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-unspecified-error-exception-from-hresult-0x80004005-e/m-p/12907944#M169723</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13698234"&gt;@gcarvac&lt;/a&gt;.&amp;nbsp; That is a tough one to diagnose with only that information to go by.&amp;nbsp; I do know that it is always a bad idea to include instructions to save within an iLogic rule that is triggered to run by either the 'Before Save Document' or 'After Save Document' events in the Event Triggers dialog.&amp;nbsp; That can create an endless loop in some situations, and can lead to errors in other situations.&amp;nbsp; No need to include instructions to save, when the document is already in the process of being saved when the code runs.&amp;nbsp; But another small detail seems odd here.&amp;nbsp; The error message says the error happened at Line 3, but Line 3 in the code sample above is this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Parameter("GSS_SortCode") = PartNumber.Substring(0,3)&lt;/LI-CODE&gt;
&lt;P&gt;..., because in the 'More Info' tab, where it is showing more details, it indicates that the error is happening when it is trying to Save.&amp;nbsp; Again, that could be because it is trying to save, while already saving.&amp;nbsp; I have seen that before multiple times.&amp;nbsp; But adding a SaveAs in the mix complicates things even further, so I'm not sure.&amp;nbsp; Also, just as added robustness against errors, you should probably check the value of 'PartNumber', to make sure it is not 'empty', before attempting to extract a sub string from within it.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Jul 2024 14:53:43 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2024-07-19T14:53:43Z</dc:date>
    <item>
      <title>ILogic Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) after SaveAs</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-unspecified-error-exception-from-hresult-0x80004005-e/m-p/12906737#M169699</link>
      <description>&lt;P&gt;I have an external ILogic rule:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;PartNumber&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"Project"&lt;/SPAN&gt;, &lt;SPAN&gt;"Part Number"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"GSS_SortCode"&lt;/SPAN&gt;) = &lt;SPAN&gt;PartNumber&lt;/SPAN&gt;.&lt;SPAN&gt;Substring&lt;/SPAN&gt;(0,3)
&lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;Save&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;When I SaveAs a document, I get&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gcarvac_0-1721351079989.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1388522i9EEE7CAE2827C3D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gcarvac_0-1721351079989.png" alt="gcarvac_0-1721351079989.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gcarvac_1-1721351089943.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1388523iA05E0D9CF63A4EFC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gcarvac_1-1721351089943.png" alt="gcarvac_1-1721351089943.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My guess is that is is because ThisDoc refers to the document where I clicked SaveAs, and the ILogic rule is triggered to run after save and therefore on the new document?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 01:11:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-unspecified-error-exception-from-hresult-0x80004005-e/m-p/12906737#M169699</guid>
      <dc:creator>gcarvac</dc:creator>
      <dc:date>2024-07-19T01:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: ILogic Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) after SaveAs</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-unspecified-error-exception-from-hresult-0x80004005-e/m-p/12907944#M169723</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13698234"&gt;@gcarvac&lt;/a&gt;.&amp;nbsp; That is a tough one to diagnose with only that information to go by.&amp;nbsp; I do know that it is always a bad idea to include instructions to save within an iLogic rule that is triggered to run by either the 'Before Save Document' or 'After Save Document' events in the Event Triggers dialog.&amp;nbsp; That can create an endless loop in some situations, and can lead to errors in other situations.&amp;nbsp; No need to include instructions to save, when the document is already in the process of being saved when the code runs.&amp;nbsp; But another small detail seems odd here.&amp;nbsp; The error message says the error happened at Line 3, but Line 3 in the code sample above is this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Parameter("GSS_SortCode") = PartNumber.Substring(0,3)&lt;/LI-CODE&gt;
&lt;P&gt;..., because in the 'More Info' tab, where it is showing more details, it indicates that the error is happening when it is trying to Save.&amp;nbsp; Again, that could be because it is trying to save, while already saving.&amp;nbsp; I have seen that before multiple times.&amp;nbsp; But adding a SaveAs in the mix complicates things even further, so I'm not sure.&amp;nbsp; Also, just as added robustness against errors, you should probably check the value of 'PartNumber', to make sure it is not 'empty', before attempting to extract a sub string from within it.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 14:53:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-unspecified-error-exception-from-hresult-0x80004005-e/m-p/12907944#M169723</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-07-19T14:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: ILogic Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) after SaveAs</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-unspecified-error-exception-from-hresult-0x80004005-e/m-p/12910944#M169769</link>
      <description>&lt;P&gt;Thanks for your help&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;. You are correct, I should check to see if PartNumber isn't empty. I hadn't thought of the possibility of the loop with the save, so I'll investigate not having that line.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 21:10:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-unspecified-error-exception-from-hresult-0x80004005-e/m-p/12910944#M169769</guid>
      <dc:creator>gcarvac</dc:creator>
      <dc:date>2024-07-21T21:10:44Z</dc:date>
    </item>
  </channel>
</rss>

