Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
iLogic Help needed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi All,
I am trying to write a rule for restricting save rights to a .ipt or .iam file. I am just starting out with ilogic and have very basic coding experience.
What I would like is for the rule to read the windows login username and depending on the result (User A) displays a radio message box asking if if the file should be restricted.
If the file is to be restricted, then the rule should allow only User A to save the file. Hopefully that makes sense.
I have posted the code I have so far. I don't know how to get the windows username so have substituted this with username for the moment.
If Username = "User A" Then
RestrictAccess = InputRadioBox("Should this file be restricted?", "Yes", "No", RestrictAccess, Title := "Restrict Access")
End If
If RestrictAccess = True And Username = "User A" Then
ThisDoc.Save
Else
ThisDoc.Document.SaveAs
End If
Re: iLogic Help needed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I don't think this is going to work.
Re: iLogic Help needed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I know my current code doesn't work. I just posted it to give an idea of what I'm looking to achieve.
Re: iLogic Help needed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
That's obvious, I mean I don't think iLogic will work for this at all.
Re: iLogic Help needed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Oh ok
Do you mean that It wouldn't be posible to get the windows username from ilogic or something else?
If it's not possibile to get the windows username, would it be possible to get the username from the applications options?
thanks for any help.
Re: iLogic Help needed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You can get the WIndows username (I don't have it at my finger tips, but I'm sue you could find a snippet if you searched the Inventor customization forum).
I just don't think iLogic will work very well for controlling file editing permissions. I don't know how much anti-tamper you need but all it would take is a right click suppress or delete on your rule to "unlock" the file. More importantly, I'm not sure how you could capture the save command to keep it from executing. Have you done any experimenting to see if it's possible?
Re: iLogic Help needed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Suppressing the rule won't be an issue as the user we're trying to restrict, doesn't have a lot of experience using inventor, and has never even heard of ilogic.
I haven't experimented with the save command yet. My thoughts on it would be to trigger the rule before save then write a rule to abort the save command and trigger the saveas command instead.
I don't know how possible this would be though.
Re: iLogic Help needed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Have you considered using read only files instead?
You could write an API routine (I don't know if it would work in iLogic) that would mark the file read only or not based on the user name...
Never underestimate the power of ignorance.
iLogic Read Only Flag / Read Only Files
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi gcooper79,
I think mrattray is probably right in thinking that iLogic might not be the best tool for this, but it doesn't hurt to try I suppose. Here are some snippets I had on hand for setting and clearing the read only flags. These snippets do it for the entire folder the file resides in, but you can change it to target only the file as needed.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'clear the read only flag on all of the files found 'in the same folder as this file 'get the file path Dim strPath As String = ThisDoc.Path & “\” ‘clear read only flag SetAttr(strPath, vbNormal + vbArchive) Dim strFile As String = Dir(strPath) Do Until strFile = "" ‘clear read only flag SetAttr(strPath & "\" & strFile, vbNormal + vbArchive) strFile = Dir() Loop
'set the read only flag on all of the files found
'in the same folder as this file
'get the file path
Dim strPath As String = ThisDoc.Path & “\” ‘clear read only flag SetAttr(strPath, vbNormal + vbArchive) Dim strFile As String = Dir(strPath) Do Until strFile = "" ‘set read only flag SetAttr(strPath & "\" & strFile, vbReadOnly + vbArchive) strFile = Dir() Loop

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: iLogic Help needed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Maybe it's easier to use a datamangement tool for this like Vault.
Theo


