×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Xojo
Posted by: Radium Kymist
Added: Feb 7, 2015 1:04 PM
Views: 42
Tags: no tags
by simulanics

Open the Directory or Finder revealing the file.
  1. Sub Reveal(Extends f  as FolderItem)
  2.   Dim shell1 as new Shell
  3.   Dim cmd as string
  4.   if f <> nil then
  5.     if f.Exists then
  6.       #IF TargetWin32 then
  7.         cmd  = "explorer.exe /select,"+ chr(34)+ f.AbsolutePath+ chr(34)
  8.         shell1.execute(cmd)
  9.       #elseIf TargetMachO or TargetMacOS then
  10.         cmd = "osascript -e 'Tell application ""Finder"" to reveal """ + f.AbsolutePath + """' -e 'Tell application ""Finder"" to activate'"
  11.         shell1.execute(cmd)
  12.       #else
  13.         ' Linux?
  14.  
  15.       #ENDIF
  16.     end if
  17.   end if
  18. End Sub