Ilogic to open document directory and select the document file

Ilogic to open document directory and select the document file

Anonymous
Not applicable
4,474 Views
3 Replies
Message 1 of 4

Ilogic to open document directory and select the document file

Anonymous
Not applicable

Hi,

I am using an easy Ilogic rule, which opens the directory of the open document via explorer.exe

 

If ThisDoc.Path IsNot "" Then
Shell("explorer.exe " & ThisDoc.Path,vbNormalFocus)
Else
MessageBox.Show("Cannot open the file directory", "iLogic")
End If

 

 

 But when I have a lot of files in the document directory, its pretty complicated to find the document file. Is there any possibility to make explorer highlight (or select) the used document file? I tried the standard functions for both explorer.exe and VBAs Shell, but it did not work.

Thank you for help!

Accepted solutions (1)
4,475 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor
Accepted solution

Pretty sure there is.

 

Since this functionality isn't specific to inventor, 2 better places to look are StackOverflow and MSDN.

 

Good luck.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 3 of 4

Anonymous
Not applicable
Thank you, you were right.
It was solved by this post at stackoverflow.com

https://stackoverflow.com/questions/31689802/launching-windows-explorer-and-highlighting-a-file

But you have to write the command after Shell into brackets.
Message 4 of 4

dusan.naus.trz
Advisor
Advisor

It took me a little bit then I understood. I give the whole solution to others.

 

Not only do you have to insert Select as an explorer, but when I used & ThisDoc.PathAndFileName (True) it bothered him in the path (True) it couldn't evaluate it, but true is needed because of the end that defines shortened and it already works

 

filepath = ThisDoc.PathAndFileName(True)

If filepath IsNot "" Then
Shell("explorer.exe /Select," & filepath, vbNormalFocus)
Else
MessageBox.Show("Cannot open the file directory", "iLogic")
End If