Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is the anyway I can se with Ilogic if I have the file check out ?

7 REPLIES 7
Reply
Message 1 of 8
Darkforce_the_ilogic_guy
700 Views, 7 Replies

Is the anyway I can se with Ilogic if I have the file check out ?

I have a illogic code that run on save .. but for some reason a lot of files get save even if I do not have the files check out. I want to make sure that it does not run part on my Ilogic code if I do not have the file check out.

 

Files that I do not have check out usually is  read only locally... is there a way to get the info form the vault or the files attribute so I can force it not to run part of my illogic code ? 

7 REPLIES 7
Message 2 of 8

Easiest way would be to query file attributes rearrange the code depending on whether it's read-only or not (assuming read-only status matches check in/out status):

If (GetAttr(file_path) And vbReadOnly)>0 Then
	MsgBox("checked out")
Else
	MsgBox("not checked out")
End If 

 

Message 3 of 8

Can you write the complete code? Are you not missing a few dim (varible) for that to work. ?
.
Message 4 of 8

The only dim missing is for whatever variable has your file path string. All you should have to do if rearrange your existing code to match the if statement:

Dim file_path as string
file_path = "your_file_path"
If
(GetAttr(file_path) And vbReadOnly)>0 Then 'copy the code you want to run if file is read only here Else 'copy the code you want to run if file is not read only here End If  

 

Message 5 of 8

he is referring to the system.io method of getting/setting file attributes

dim fi as new system.io.fileinfo("c:\FullFilePath\With\File.Ext") 

 System.IO.File.SetAttributes(fi.FullName, System.IO.FileAttributes.Normal)

system.io.file.GetAttributes(fi.FullName) as FileAttributes

This is actually a risky method to determine if the file is checked out, because occasionally (not by design), a vaulted file will be checked out, but still have the readonly attribute set.

 

 

jvj
Message 6 of 8
demuff
in reply to: JamieVJohnson2

iLogic recognizes GetAttr() without needing to explicitly go through System.IO, but that certainly works as well. Agreed that reading the file state is not a very robust solution, but it may work well enough here.

Message 7 of 8
JamieVJohnson2
in reply to: demuff

For sure its better than 1. nothing, and 2. learning the vault professional API.

jvj
Message 8 of 8

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report