How To Get Finder Home Folder Path
Is there a programmatic way to get the home folder path?
I'm using sf.app.proTools.importSessionData
and one of its arguments trackDataPresetPath
requires the full path to a pro tools track import data preset, ie:
"/Users/mymac/Documents/Pro Tools/Pro Tools Presets/Track Data to Import/My Setting.ptpreset
This works great on my 1 computer, but obv. won't on my others which have different home folder names.
Is there a way to get the path to the home folder of the current system?
- MMatt Friedman @Matt_Friedman
I tried using this and it seems to work!
sf.appleScript.finder.home.path.toString()
- In reply toMatt_Friedman⬆:Kitch Membery @Kitch2024-11-15 18:33:50.951Z2024-11-15 19:06:54.924Z
Hi @Matt_Friedman,
Try this...
"~/Documents/Pro Tools/Pro Tools Presets/Track Data to Import/My Setting.ptpreset"
Let me know if that works for you. :-)
- MMatt Friedman @Matt_Friedman
I did try the tilde initially but it didn’t work. Maybe that’s a terminal thing??
Kitch Membery @Kitch2024-11-15 19:10:20.897Z
Hi @Matt_Friedman,
I just noticed that I missed the closing quotation mark...
The tilde should work.
- In reply toMatt_Friedman⬆:
Kitch Membery @Kitch2024-11-15 19:12:40.531Z
Example...
sf.file.open({ path: "~/Documents/" });
- MMatt Friedman @Matt_Friedman
I think the problem is that the path is used by the pro tools SDK and I think that’s what’s rejecting the tilde.
Kitch Membery @Kitch2024-11-15 19:56:34.799Z
Ahh, I see... Thanks for clarifying... Out of interest, what was the piece of code you were passing the path into? I assume it was the
sf.app.proTools.importSessionData
method?Thanks in advance.
- MMatt Friedman @Matt_Friedman
const homePath = sf.appleScript.finder.home.path.toString(); function importSession(importFile) { sf.app.proTools.importSessionData({ audioHandleSize: 1000, adjustSessionStartTimeToMatchSource: false, audioMediaOptions: "LinkToSourceAudio", importClipGain: true, importClipsAndMedia: true, importVolumeAutomation: false, playlistOptions: "ImportReplaceExistingPlaylists", sessionPath: importFile, timecodeMappingStartTime: "00:00:00:00", timecodeMappingUnits: "MaintainAbsoluteTimeCodeValues", trackDataPresetPath: homePath + "Documents/Pro Tools/Pro Tools Presets/Track Data to Import/Audio Only.ptpreset", trackMatchOptions: "MatchTracks", videoMediaOptions: "LinkToSourceVideo", }) }
Kitch Membery @Kitch2024-11-15 20:08:52.478Z
Perfect! Thanks. :-)