set scriptToRun to "/bin/zsh -c /usr/local/bin/pandoc --template=/Users/xxx/Documents/Pandoc_Templates/default_copy.latex --latex-engine=lualatex '/Users/xxx/Box Sync/Work/pathToFiles/'*.markdown -o '/Users/xxx/Box Sync/pdf Notes.pdf'"
do shell script scriptToRun
I know that the pandoc command works as I can run it in my zsh terminal and get the required pdf output in the required directory. When I run the applescript, I don’t get any errors but I it does not produce the output pdf.
Can someone help me get this working?
Many thanks
Model: MBP
AppleScript: v 2.7
Browser: Safari 600.5.17
Operating System: Other
I don’t have any of your utilities, so it is pretty hard to just guess, but try removing the apostrophes, especially the ones in the path prepending the glob. (I guess zsh, reads in your full path, from some zsh .profile script or similiar. Yet, it can be educational to just have a do shell script that zsh -c echo $PATH. I do also find it strange that you don’t have to embillish the whole command string to zsh (the -c argument) in apoostrophes.
I have got it working. The whole command need to be surrounded by single apostrophes like this:
/bin/zsh -c 'command'
Any spaces within the file path/name need to escaped but using “quoted form of” does not work because the first apostrophe around the path is assumed to be the closing apostrophe for the actual command. Therefore, I manually replaced all spaces with \space. The final applescript line looks like this:
set scriptToRun to "/bin/zsh -c '/usr/local/bin/pandoc --template=/Users/xxx/Documents/Pandoc_Templates/default_copy.latex --latex-engine=/usr/texbin/lualatex /Users/xxx/Box\ Sync/Work/pathToFiles/*.markdown -o '/Users/xxx/Box\ Sync/pdf Notes.pdf'"
set scriptToRun to "/bin/zsh -c " & quoted form of "/usr/local/bin/pandoc --template=/Users/xxx/Documents/Pandoc_Templates/default_copy.latex --latex-engine=/usr/texbin/lualatex '/Users/xxx/Box Sync/Work/pathToFiles/'*.markdown -o '/Users/xxx/Box Sync/pdf Notes.pdf'"