• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Looking for a valid copy of SaveAI_to_PDF script

Explorer ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

Hi Everybody,

 

As many of you might know, AI files don't show previews/quick look on Finder due to security issues. I download several AI files from Adobe Stock daily so this is a real nagging pain for sorting. No, I'm not going to use Bridge or any app, just not my workflow, thank you. 

 

I've been through the gamut, old 2010 scripts to Github respositories to Chat GPT automator instructions (that don't work). Modified vesions of the script...

 

I just need the actual script to create a folder automation so any AI file that lands in the downloads folder is converted to a layered PDF. 

 

Is there a viable copy of this script somewhere so I can run this process in my downloads folder without having to actively? 

TOPICS
How-to , Scripting

Views

156

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Explorer ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

I managed to prompt a valid one on chat (attached - need to change extension to .jsx to use), but I can't seem to get the thing to load in automator the right way. It might have a hard time locating Illustrator or compiling it natively. Still trying to make a folder automatically convert an AI file into layered PDF for file visibility. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

What type of computer system are on you using (macOS or Windows)? I assume you are on a Mac from some of the terminology you are using... If so, there are some options to use Folder Actions to process file with a JSX script. Just let us know for certain your system and then we can help more.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

Hey jduncan,

 

I'm in Automator for Sonoma. I can get the AI->PDF script to work, but the automator using applescript isn't picking up the automation:

 

-- AppleScript to run ExtendScript (JSX) in Adobe Illustrator

on adding folder items to theFolder after receiving theNewItems
tell application "Adobe Illustrator"
activate
-- Path to your ExtendScript (JSX) file
set jsxFile to POSIX file "~/Documents/05_Scripts/convert_to_layered_pdf.jsx"
-- Execute the ExtendScript file
do script jsxFile language javascript
end tell
end adding folder items to

 

I've got this script loaded into Automator's ("Folder Action") Macro/Preset or whatever it's called for the Downloads folded. But upon running it from the Finder>Services drop down...it's just dead. So I know it's not the JSX file. I just can't seem to get finder to hollar at Illustrator to run the JSX folder script.    

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

Ok, so this is definitely doable but there are some gotchas...

 

First though, I don't download from Adobe Stock but any .AI files I download have Finder previews and work fine with Quicklook. What they show may not always be exact (Apple renders some things funny it doesn't understand), but they do show up for me.

 

I see a few doable options for you...

 

Option #1:

You can process the files as they are downloaded but this has a few issues. First Apple typically places a quarantine flag on download files so they are not acted upon by AppleScript handlers like 'on adding folder items' (read more). We tackled this problem last week on this forum here. Second, if you have to do a little extra work to ensure all files are fully downloaded before running yout script (read more).

 

If you can work around those two problems, you would need to edit your script a bit to accept the paths from AppleScript as arguments (instead of grabbing all AI files as it does now). You can see how that is done in the forum link above.

 

Option #2

Using your script as is. I only glanced at your script but it reads in every file from your Downloads folder that is and ".ai" file and then does the PDF coversion on each. If you regularly clean out your Download folder this wouldn't be a problem but if you leave AI files in there over time, this script will continually process the same files over and over since it acts upon every ".ai" it finds. You could add a 'continue' clause in your script loop that checks if a file has a matching PDF to skip already processed file.

 

This option is a bit easier to implement though as you only need to watch for downloaded items, await them downloading and then just run the script. You still have to deal with the quarantine issue though.

 

As a final option (that cost money), you can use an app like Hazel from Noodlesoft to watch your downloads folder. Hazel is amazing and can be used for all sorts of operations, including running AppleScript scripts.

 

Let me know if you get stuck anywhere and need some help. Good luck!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 16, 2024 May 16, 2024

Copy link to clipboard

Copied

Hi jduncan, thanks for the very thorough response. I had to get time before work before responding. 

 

I will have tos spend more time reviewing the other thread w/ regards to Downloads folder quarantine.

 

Also, I didn't consider the listener to be persistent with still present AI files in the downloads folder. That could create a real Strega Nona pasta pot scenario, yikes! (obscure ref. like jack beanstalk). I would want to delete the AI file in question after processing. 

 

I will have to check out Hazel as well. It looks interesting even if it's not perhaps a conversion app at first galnce. I dig utility apps so thanks for the reference! 🙂

 

Thanks so much for the time!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 16, 2024 May 16, 2024

Copy link to clipboard

Copied

Hey jduncan, 


I know you work over in the macOS world, but do you have any ideas for the Windows side?
I'm currently using a HEFTY extendscript that searches a certian folder every x seconds in the background when I'm not activly using Illustrator and opens and coverts the ai file to a pdf, but it pretty much renders my computer useless if I try to work on anything else.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 17, 2024 May 17, 2024

Copy link to clipboard

Copied

LATEST

So I don't have a way to test anything for Windows but it seems doable. There is a paid app called File Juggler (link) that can watch a folder and act upon any new files (similar to what Hazel app does on my Mac). One of the possible actions for File Juggler is "Run Command" (read more) which allows you to run a command prompt command with the info of the new file(s).

 

From the posts linked below, it seems you can run an Illustrator script (with arguments) from the Windows command line. So you would just need to sort out the specifics on your personal machine to determine the folder to watch, the script that needs to run, and the how to access the proided arguments in your script.

 

More Info:

 

This is something I have successfully done on the Mac in pretty much the exact same steps but I'm not sure any code I have would help that much...

 

Also, I know there is VBS scripting on Windows so that may be another route you can explore. I have seen it mentioned on the forum before...

 

Finally, there may be a free option for monitoring a folder on Windows so here are some things that popped up when I searched for that...

 

If you want to try and put something together, I will be glad to help and troubleshoot the best I can if you run into any issues.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines