M4L user relative filepath of external media
Having a hard time wrapping my mind around how to solve a particular issue I've been working on.
I'm creating a M4L device that utilizes a significant quantity (eventually 1000+) of XML's, each to be parsed (using Sadam.rapidXML) upon being triggered . These files are intended to be downloadable by other users (in packs of around 50) and put in the M4L device in any number of configurations (using the live.drop object), OR simply played back in an existing project with the XML's already mapped.
My problem is that I'd like to create a heirarchy that will be available on other users computers, to where they can just point to a particular folder on their drive, and not have to worry about it again.
For example, on the machine that they originate from, the filepath of an XML might be ""C:/Users/Me/Static/XMLs/Projects/Equinox/Example"
For a deliverable project, the XML's will already be in the device, so obviously I can't use an absolute search path for that. I'm looking for a way so that the user can specify the location of the folder "XMLs" and use that part of the filepath for their XML's, so that when they trigger that XML, it would parse the XML in the filepath "C:/Users/You/Documents/XMLs/Projects/Equinox/Example" on their machine.
Ideally, I'd like to store just the path "XMLs/Projects/Equinox/Example" in the device (which will be delivered in a collected Ableton session), and have the user specify the path to the XMLs folder which will then be prepended just before it gets parsed.
Any guidance on how I could efficiently accomplish this would be greatly appreciated. Cheers!
(Sorry if this was longwinded, I'm not the best at cliffnotes)
Bumping this thread. Anyone have any suggestions?
What's so difficult about this? Seems you pretty much answered your own question, have the user pick the folder for their XMLs and then store that path within the device in a textedit or save the path in a .txt file in the same directory as the device itself so all instances of the device can look up the path.
You can use a [pattr], the second output, on a [textedit] with a script name and (parameter_enable 1).
That way the path will be save with you Live set, and avoid file handling, as you want to have a preset that will be different for each Live set and each time you use a device in a Live set and you don't want it to change if you change it from track, lets say. That said, if you actually want to have one path for all devices on the same computer, Jdudeo's solution is best.
You don't need the pattr, textedit with parameter mode works on its own
Thanks for the replies @Jdudeo and @Musinou. The part that I'm not sure how to accomplish is how to parse and separate out the parts of the filepath. Unless I'm missing something, objects like unjoin, unpack, and route won't work for this as the folders are separated by slashes as opposed to spaces, strippath takes away too much of the path, conformpath doesn't seem to format it to where any of the previously mentioned objects. How would you go about actually pulling apart the path to put it back together later?
Yes, I meant [pattr] or* (parameter_enable 1)
Look at [strippath], [absolutepath], [thispatcher], [regexp], [sprintf], [folder]