Displaying a file on disk

I set that feature to a newly added window and noticed that the .Parent folder is opened, but my file is not selected.

Any hint to how I can achieve that (Linux, macOS, Windows) ?

Actual code (f is the item to reval):

If f <> Nil And f.Exists Then f.Parent.Launch End If

PS: Reveal in AppleScript works fine (in the Scrip Editor).

Here’s the code for the macOS, include it in a module and then call it with folderitem.showInFinder.

[code]Public Sub showInFinder(extends f as folderitem)
#if TargetMacOS then
// — Created for the forum, April the 4th 2020 by Sam Rowlands
declare function NSClassFromString lib “Foundation” ( className as CFStringRef ) as integer
declare function NSMutableArrayWithCapacity lib “AppKit” selector “arrayWithCapacity:” ( NSMutableArrayClass as integer, capacity as integer ) as integer
declare sub NSMutableArrayAddObject lib “AppKit” selector “addObject:” ( NSMutableArray as integer, objectInstance as integer )
declare function NSUrlfileURLWithPathIsDirectory lib “AppKit” selector “fileURLWithPath:isDirectory:” ( NSURLClass as integer, path as CFStringRef, folder as boolean ) as integer
declare function NSWorkspaceSharedWorkspace lib “AppKit” selector “sharedWorkspace” ( NSWorkspaceClass as integer ) as integer
declare sub NSWorkspaceActivateFileViewerSelectingURLs lib “AppKit” selector “activateFileViewerSelectingURLs:” ( shrdWorkSpace as integer, inUrls as integer )

Dim fileArray as integer = NSMutableArrayWithCapacity( NSClassFromString( "NSMutableArray" ), 1 )
NSMutableArrayAddObject( fileArray, NSUrlfileURLWithPathIsDirectory( NSClassFromString( "NSURL" ), f.nativePath, f.directory ) )
NSWorkspaceActivateFileViewerSelectingURLs( NSWorkspaceSharedWorkspace( NSClassFromString( "NSWorkspace" ) ), fileArray )

#endif
End Sub
[/code]

Ouch ! Thank you Sam.

Any taker for Windows ?

Myfile.parent.launch

?

I have to fire Windows (VirtualBox) and check…

Apparently, it does not works. I will check a second time.

I confirm (or too low memory condition): nothing is done. Even when I close the Explorer’s window, nothing happens.