I'm coding a small Automator script with an Applescript in it. The Applescript runs a shell script that downloads some images to a specified folder. The next step in the Automator script makes a PDF from those images. Small problem, the creation of the PDF already starts before the downloading of the images is done, so i get an empty PDF file. how can i let Automator wait until the Applescript is done downloading before it gets to the next step?
|
What shell command(s) are you using to do the download? curl? One way to do this would be to add something to the shell script after each download, like:
then make sure your applescript only starts the pdf part after it finds the file1.deleteme file and deletes it. When I do this with curl, it will not make that empty file until it is done downloading. the AS part could start with something like (danger, not tested):
or, if you prefer (or if this makes more sense depending on what your code looks like: do the shell script for all files, create a more generic deleteme file after they are all done, then do the pdf stuff. |
|||
|
Automator does wait until Run Script actions are done. The problem, at a guess without seeing your code, is that your AppleScript is using some sort of asynchronous download method -- telling Safari, perhaps? -- so the script finishes before the download is actually done. Using a synchronous method, such as the above suggestion of By the way, using a Run Script action to call |
|||
|