I'm trying to read the content of the key 'projectdirectory' in a plist. Currently I have a clumsy approach with BBEdit. I'd prefer a smart solution, preferably one that runs in the background. All I need is the string '/Users/hl/Dropbox/CT/Pro/abc/abc2023-07-20-2'.
Hey there, it looks like you’re already familiar with RegEx, so that’s good (I did adjust the RegEx in my example a little though). All you really need to do is use the read a file action to get that file’s contents into a variable (or clipboard if you prefer)... for instance, see my example below. ↓
I know there are other ways to do it... like using the command line’s plutil command, but that’s probably overly complex for what you need and I’m not as familiar with it anyway.
Ok, that makes sense. I forgot about not being able to read a plist file directly from that action. My apologies. So then try the following. It uses the plutil command line tool I mentioned earlier. Just verify that the file path to your plist file in question is correct in the shell script action.