<?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 code running every 15 minutes or every 100 actions in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/7260739#M73843</link>
    <description>&lt;P&gt;Just use this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub Main()
	Dim Thread1 As New System.Threading.Thread(AddressOf AutoSave)
	Thread1.Start()
End Sub

Sub AutoSave()
	Dim AST As Integer = 0
	While True
		If AST &amp;gt;= 15 Then &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'15 minutes&lt;/STRONG&gt;&lt;/FONT&gt;
			AST = 0
			Dim SF As DialogResult = MessageBox.Show("Do you want to save?", "Autosave", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
			If SF = vbYes Then
				ThisDoc.Save()
			End If
		Else
			AST += 1
		End If
		System.Threading.Thread.Sleep(60000) &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'1 minute = 60000 ms&lt;/STRONG&gt;&lt;/FONT&gt;
	End While
End Sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want it to be 100 actions instead of 15 just do the maths. It'll be 100 and &amp;nbsp;9000&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jul 2017 09:22:46 GMT</pubDate>
    <dc:creator>Owner2229</dc:creator>
    <dc:date>2017-07-28T09:22:46Z</dc:date>
    <item>
      <title>iLogic code running every 15 minutes or every 100 actions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/7260380#M73839</link>
      <description>&lt;P&gt;I'm trying to write a little autosave script. Despite all pros/cons for this idea, I'd like to know how to make it work.&lt;/P&gt;&lt;P&gt;One little advice was given &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/auto-save/idi-p/5953385" target="_self"&gt;here&lt;/A&gt;, but it doesn't seem to work for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By tweaking the code a bit, it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;If AutoSaveTrigger &amp;gt;= 100 Then
	AutoSaveTrigger = 0
	savefile = MessageBox.Show("Do you want to save?", "Autosave", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
	If savefile = vbYes Then
		ThisDoc.Save
	End If
Else
	AutoSaveTrigger += 1
End If&lt;/PRE&gt;&lt;P&gt;and I assign it to parameter change. However, it doesn't do anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it has something to do with AutoSaveTrigger, but I can't put my finger on it. I dont' know if Inventor "forgets" this parameter value once the rule is fired.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bonus question: would it be possible to do so that the rule runs every 15min instead of every 100 actions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: just a few thoughts from another thread:&lt;/P&gt;&lt;P&gt;- I know that there is a "save reminder", but that's not what I'm looking for&lt;/P&gt;&lt;P&gt;- I started with iLogic because I want this event to activate periodically, like 100 actions after or 15 min after the last save. I'm willing to switch to VB.net if it adds any benefit.&lt;/P&gt;&lt;P&gt;- If done in iLogic, I'd add the code to the template doc so that it's used in all parts, assemblies and drawings from now on.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 06:20:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/7260380#M73839</guid>
      <dc:creator>francesco.dinh</dc:creator>
      <dc:date>2017-07-28T06:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic code running every 15 minutes or every 100 actions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/7260739#M73843</link>
      <description>&lt;P&gt;Just use this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub Main()
	Dim Thread1 As New System.Threading.Thread(AddressOf AutoSave)
	Thread1.Start()
End Sub

Sub AutoSave()
	Dim AST As Integer = 0
	While True
		If AST &amp;gt;= 15 Then &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'15 minutes&lt;/STRONG&gt;&lt;/FONT&gt;
			AST = 0
			Dim SF As DialogResult = MessageBox.Show("Do you want to save?", "Autosave", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
			If SF = vbYes Then
				ThisDoc.Save()
			End If
		Else
			AST += 1
		End If
		System.Threading.Thread.Sleep(60000) &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'1 minute = 60000 ms&lt;/STRONG&gt;&lt;/FONT&gt;
	End While
End Sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want it to be 100 actions instead of 15 just do the maths. It'll be 100 and &amp;nbsp;9000&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 09:22:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/7260739#M73843</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-07-28T09:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic code running every 15 minutes or every 100 actions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/7262225#M73859</link>
      <description>&lt;P&gt;Whoa, thanks! Sorry if I haven't replied all day, I'll try it right along when I'll be back to my office. Thanks a bunch!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 19:36:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/7262225#M73859</guid>
      <dc:creator>francesco.dinh</dc:creator>
      <dc:date>2017-07-28T19:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic code running every 15 minutes or every 100 actions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/7264521#M73879</link>
      <description>&lt;P&gt;Here's the code with&amp;nbsp;a document check to prevent an attempt to save closed document.&lt;/P&gt;
&lt;P&gt;It will keep reseting until you (re)open new(another) document.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub Main()
	Dim Thread1 As New System.Threading.Thread(AddressOf AutoSave)
	Thread1.Start()
End Sub

Sub AutoSave()
	Dim AST As Integer = 0
	While True
		If ThisDoc IsNot Nothing Then
			If AST &amp;gt;= 15 Then &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'15 minutes&lt;/STRONG&gt;&lt;/FONT&gt;
				AST = 0
				Dim SF As DialogResult = MessageBox.Show("Do you want to save?", "Autosave", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
				If SF = vbYes And ThisDoc IsNot Nothing Then
					ThisDoc.Save()
				End If
			Else
				AST += 1
			End If
		Else
			AST = 0
		End If
		System.Threading.Thread.Sleep(60000) &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'1 minute = 60000 ms&lt;/STRONG&gt;&lt;/FONT&gt;
	End While
End Sub&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jul 2017 05:27:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/7264521#M73879</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-07-31T05:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic code running every 15 minutes or every 100 actions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/9343440#M106341</link>
      <description>&lt;P&gt;Thank you so much! This works great!&lt;BR /&gt;&lt;BR /&gt;Is there a way to have the window that pops up force a user to make a choice? I see that I can miss-click and the window disappears.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 17:33:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/9343440#M106341</guid>
      <dc:creator>nkirton</dc:creator>
      <dc:date>2020-02-26T17:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic code running every 15 minutes or every 100 actions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/9787651#M116678</link>
      <description>&lt;P&gt;Please help,&lt;/P&gt;&lt;P&gt;by me run rule after close document or inventor fall down.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2020 20:55:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/9787651#M116678</guid>
      <dc:creator>josef_kostecký</dc:creator>
      <dc:date>2020-10-06T20:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic code running every 15 minutes or every 100 actions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/10133409#M121777</link>
      <description>&lt;P&gt;How to exclude the Thread1 "Autosave" if I regret to use.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 15:27:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/10133409#M121777</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-05T15:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic code running every 15 minutes or every 100 actions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/11646364#M147154</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3072914"&gt;@Owner2229&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this code in Inventor 2023 .. With my Inventor Session kept open and if I dont attend the computer for a while.. Multiple Autosave dialogue box pop-ups appears where when choosing the yes or no option is crashing Inventor ..&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also what does this Else logic do&lt;/P&gt;&lt;PRE&gt;        Else
            AST += 1&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you kindly help me to resolve this issue.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 08:12:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-running-every-15-minutes-or-every-100-actions/m-p/11646364#M147154</guid>
      <dc:creator>Aadithya01</dc:creator>
      <dc:date>2022-12-29T08:12:39Z</dc:date>
    </item>
  </channel>
</rss>

