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

Can an Action close a file without saving - or asking permission ???

Engaged ,
Jun 30, 2020 Jun 30, 2020

I'm using an Action in a Batch operation. The procedure opens each AI file in an Input folder, one at a time, and writes a specific size JPG into an Output folder. 

 

Since the AI files aren't being changed, I don't need or want to save them. (I'd prefer not to, in order to preserve their last edit timestamp.)

 

But the Action script can't close a file without saving! So I have to choose NO for every file in the batch. I tried inserting a Revert command before the Save, but Revert also asks for permission. (Yes, the Action is being run without the dialog option enabled.)

 

Is there a way for an Action to close a file without saving or asking permission? Having to grant permission for each file, from a folder that might contain hundreds of files, defeats some of the convenience of a Batched Action.

 

Thanks in advance,

 

Allen

 

TOPICS
Tools
3.4K
Translate
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

correct answers 1 Correct answer

Community Expert , Jun 30, 2020 Jun 30, 2020

there's a flag that tells the application the document needs saving. We can turn that flag off with this script

// turn edited flag off
activeDocument.saved = true;

 

- place the script in the scripts folder

- restart illustrator

- record an action to run the script

- insert the action right before closing the document in you existing action set

- batch as usual

 

let me know if it works for you.

 

thanks

Carlos

 

Translate
Adobe
Community Expert ,
Jun 30, 2020 Jun 30, 2020

there's a flag that tells the application the document needs saving. We can turn that flag off with this script

// turn edited flag off
activeDocument.saved = true;

 

- place the script in the scripts folder

- restart illustrator

- record an action to run the script

- insert the action right before closing the document in you existing action set

- batch as usual

 

let me know if it works for you.

 

thanks

Carlos

 

Translate
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 ,
Jun 30, 2020 Jun 30, 2020

Worked like a charm.

Thanks!

 

Translate
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
New Here ,
Jul 06, 2023 Jul 06, 2023

Hi Carlos,

 

I followed your instruction and the image attached was the result of my first batched file. What am I doing wrong?

Translate
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
New Here ,
May 19, 2025 May 19, 2025

Hi Carlos,

I copy and pasted the command into TextEdit and saved as rich text and converted to JSX.

When I try to run this script, I get a syntax error. Could you help me out with this? 


I am trying to run a batch export of AI to PNG but when I do, it starts saving the AI file with the PNG file in the specified folder. 

Translate
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
Community Expert ,
Jun 11, 2025 Jun 11, 2025
LATEST
quote

Hi Carlos,

I copy and pasted the command into TextEdit and saved as rich text and converted to JSX.


By @Evan5C9D

 

you need to save the jsx file as Plain Text, not Rich Text

Translate
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
Advisor ,
Jun 30, 2020 Jun 30, 2020

I tried this with a simple export .jpg action and then while recording the action hit Command+W to record the Close action. Stopped recording of the action and ran the action. This worked for me. Make sure to try Button Mode and asigning key commands to actions. 

Translate
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 ,
Jun 30, 2020 Jun 30, 2020

Thanks, PrepressPro1 -- I'll try that. Maybe Cmd/Ctrl-W works differently than using File | Close in the menu.

 

Allen

 

Translate
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 ,
Jun 30, 2020 Jun 30, 2020

Didn't work for me. Even if I record the action and use Ctrl-W to close the file, selecting "don't save" from the save dialog, the dialog appears whenever the action runs. Perhaps it behaves differently on Windows, and/or with .ai files.

 

 

Translate
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 ,
Jun 30, 2020 Jun 30, 2020

Thanks, Carlos. I'll try that and report back.

Cheers, and stay safe,

Allen

 

Translate
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