Passing a parameter containing a path and folder name to a script
Tahoe 26.2. Studio Mac.
I'm not an AppleScript programmer. Please excuse me if I make some very fundamental mistakes.
I have an SMB mounted Synology NAS on which there is a volume with a shared folder "Music Root"
The script on the Mac HDD looks into the NAS folder "Music Root" which contains sub-folders with the data (files) to be processed.
set scriptFolderHFS to (path to library folder from user domain as string) & "Scripts:My Scripts:"
set defaultFolder to POSIX file "/Volumes/Music Root)/" as alias
set chosenFolder to choose folder with prompt "Choose a folder to process:" default location defaultFolder
I am able to select the target chosen sub-folder (chosenFolder) which is later passed as a parameter to the next script and is where things fall over.
-- Combine folder and filename. This is the path and filename of the next script to run
-- which it may or may not find because the parameter looks dodgy.
set fullScriptPath to scriptFolderHFS & scriptFilename
-- Load and run the script with chosen folder as argument
try
set scriptAlias to alias fullScriptPath
set loadedScript to load script scriptAlias
run script loadedScript with parameters {chosenFolder}
Can’t make file ":Music Root/AAA/A TEST folder/" into type alias.
Path: Macintosh HD:Users:arhd:Library:Scripts:My Scripts:MP3 Prep Renaming.scpt
The chosenFolder seems to have gained a leading ":" which looks a bit HFS and I have learned that either POSIX or HFS can be used but not both.
Looking at how chosenFolder is constructed, I am at a loss.
I hope that this makes some sense too.
Any help gratefully received 🙂
Mac Studio (2023)