MAC - get folder path

Mac
I want to develop a button that when the use clicks it - it allows him to navigate to a particular folder in finder and then capture that folderpath and display it in a textbox

Thanks
jim

What have you tried so far?

a) You need a dialog to select a folder.
b) Then you need to save the folderitem in a property so that you can show the folderitem in the textfield.
c) For revealing the file in Finder you may need to look for a declare in the forum. I’m using a function from the MBS plugin: NSWorkspaceMBS.selectFile(theFolderitem) . In the good old times it was quite simple to use an AppleScript. But Apple doesn’t like AppleScripting the Finder anymore.

Add a TextField and a Button to a window. In the Button’s Action event:

var f as FolderItem = SelectFolder
if f <> nil then
  TextField1.Value = f.NativePath
end if

Beatrix - Thanks
Anthony - Much thanks - it worked perfectly !!!

I was close… I had
dim dlg as OpenDialog
dim f as folderItem
dlg=new OpenDialog
f=dlg.ShowModal()
MessageBox f.nativepath

but of course it kept gining me the path and file that I had to select…

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.