Reveal file in Explorer

  1. ‹ Older
  2. last year

    Emile S

    12 Jul 2018 Europe (France, Strasbourg)

    The code below simply opens the owning folder, it does not select the passed item, as I suspected:

     Dim f As FolderItem
      
      f = GetFolderItem("Network Interfaces.app") // Beside the running project
      
      showurl f.parent.urlpath
  3. Christian S

    12 Jul 2018 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    Or use NSWorkspaceMBS .selectFile(file as folderitem) as boolean in MBS Plugin for Mac:

    dim f as FolderItem
    
    f=SpecialFolder.Desktop.Child("test.txt")
    
    if NSWorkspaceMBS.selectFile(f) then
      MsgBox "Ok"
    else
      MsgBox "failed"
    end if
  4. Christian S

    12 Jul 2018 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    for Windows, you can use WindowsShellExecuteMBS :

    dim e as Integer
    dim f as FolderItem
    
    // show documents folder
    
    f = SpecialFolder.Documents
    e = WindowsShellExecuteMBS(0, "explore", f.AbsolutePath, "", "", 10)
  5. I prefer my Mac

    Dim f As FolderItem
    f= SpecialFolder.Pictures // or other folder
    If f <> Nil Then
    f.Launch
    End If

    Harry

  6. Emile S

    12 Jul 2018 Europe (France, Strasbourg)

    @Rudolf J I prefer my Mac

    but it does not highlight the file as requested by the op. :(

  7. 3 weeks ago

    Julian S

    Sep 25 Pre-Release Testers, Xojo Pro UK

    Here's the SHOpenFolderAndSelectItems version, tested in 32 and 64. It will allow you to pop open a Windows Explorer with multiple files selected.

    https://www.dropbox.com/s/q6eog4rkta8l45e/SHOpenFolderAndSelectItems.xojo_binary_project?dl=0

  8. Norman P

    Sep 25 Pre-Release Testers, Xojo Pro great-white-software.com/blog
    Edited 3 weeks ago

    updated my blog post with a link to your code

  9. 24 hours ago

    Karen A

    24 hours ago Pre-Release Testers

    @Julian S Here's the SHOpenFolderAndSelectItems version, tested in 32 and 64. It will allow you to pop open a Windows Explorer with multiple files selected.

    https://www.dropbox.com/s/q6eog4rkta8l45e/SHOpenFolderAndSelectItems.xojo_binary_project?dl=0

    in that code what is COM.SIZEOF_PTR ?

    When i try to compile I get "this Item does not exist"

    Thanks
    Karen

  10. 19 hours ago

    Julian S

    19 hours ago Pre-Release Testers, Xojo Pro UK
    Edited 17 hours ago

    Its used to space things correctly for 32/64 bit, its a value that changes from 4 to 8 depending on if you're compiling for 32 or 64 bit (the size of a pointer, which changes), you can use a const inside a #If Target32Bit if its not in that edition of xojo:

    At the top of that method put:

    #If Target32Bit
      Const SIZEOF_PTR = 4
    #Else
      Const SIZEOF_PTR = 8
    #EndIf

    Then remove the COM. infront of the two lines which have COM.SIZEOF_PTR so it uses the const instead.

    Out of interest, which version of Xojo are you trying this on as if the #if doesn't work on that edition, just replace it with a 4 or 8 depending on your target.

  11. 13 hours ago

    Karen A

    13 hours ago Pre-Release Testers

    @Julian S Its used to space things correctly for 32/64 bit, its a value that changes from 4 to 8 depending on if you're compiling for 32 or 64 bit (the size of a pointer, which changes), you can use a const inside a #If Target32Bit if its not in that edition of xojo:

    At the top of that method put:

    #If Target32Bit
      Const SIZEOF_PTR = 4
    #Else
      Const SIZEOF_PTR = 8
    #EndIf

    Then remove the COM. infront of the two lines which have COM.SIZEOF_PTR so it uses the const instead.

    Out of interest, which version of Xojo are you trying this on as if the #if doesn't work on that edition, just replace it with a 4 or 8 depending on your target.

    Thanks!

    I'm not sure... On my mac when I tried to complier for Windows in was either 2018r3 0r 2019R1.1... When I tried in parallels with Windows 7 it was some older version... maybe from 2015 or 2016... I can tell you this evening after I get home what version it was.

    -Karen

or Sign Up to reply!