iLogic Vault Check In Active Document

iLogic Vault Check In Active Document

chendersonCRKPU
Contributor Contributor
955 Views
5 Replies
Message 1 of 6

iLogic Vault Check In Active Document

chendersonCRKPU
Contributor
Contributor

Hi All,

 

I'm experimenting with the new iLogic Vault snippets in Inventor 2024.

 

Can someone suggest how I can alter the code of the 'Check In Active Document' snippet to automatically select OK when the check in dialog box appears? I don't want any manual intervention from the user during this process.

 

Try
	ThisDoc.Save
	Dim oControlDef As Inventor.ControlDefinition
	oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop")
	oControlDef.Execute2(True)
Catch ex As Exception
	Logger.Error("Undo Check-In failed; likely, the file wasn't checked out.")
End Try

 

0 Likes
Accepted solutions (1)
956 Views
5 Replies
Replies (5)
Message 2 of 6

JelteDeJong
Mentor
Mentor
Accepted solution

You could try something like this:

'Validate user's login state
If iLogicVault.LoggedIn = False
	msgbox("Not Logged In to Vault! - Login first and repeat executing this rule.")
	Exit Sub
End If

iLogicVault.AddFile(ThisDoc.Document.FullFileName, "$/Designs", True)
msgbox("done")

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 6

chendersonCRKPU
Contributor
Contributor

thanks @JelteDeJong 

While this works there are a couple of drawbacks to this method:

  1. It doesn't automatically include dependent child files in the check in
  2. If checking in a drawing, the code does not work if the drawing file is open.

I discovered the following code that achieves the check in automatically without user input:

 

Dim oControlDef As Inventor.ControlDefinition
oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop")
oControlDef.Execute2(False)
System.Windows.Forms.SendKeys.SendWait("" & Chr(9) & vbCrLf)

0 Likes
Message 4 of 6

zmattsonM796C
Participant
Participant

Hey guys, did you ever have any trouble using:

 

System.Windows.Forms.SendKeys.SendWait("" & Chr(9) & vbCrLf)

 

It worked for me the other day but seems unreliable

 

introducing Threading.Thread.Sleep delays doesn't seem to help

 

 

0 Likes
Message 5 of 6

Michele_DeLucaSW7PJ
Contributor
Contributor

i just tried now and it works, it automatically goes to ok

0 Likes
Message 6 of 6

g.georgiades
Advocate
Advocate

The command is not 100% automatic/background. It requires Inventor to stay in focus to work. I put this bit before the SendKeys to try to ensure inventor has focus even if the user has clicked away or some program has stolen focus. Though there is a chance it may not always work, but it seems more reliable in my case.

 

AppActivate(ThisApplication.Caption)