Skip to main content
August 20, 2009
Answered

Need to suppress the save popup

  • August 20, 2009
  • 3 replies
  • 3978 views

We want to save a Sketch which is not saved in the disk locally (Eg. Let say currently the sketch name is Untitled-1)  through Adobe api.  We are using the following adobe illustrator api to save the sketch internally.

error = sAIDocument->WriteDocument(fullFilePath, kAINativeFileFormat, false)

But after calling the api the untitled sketch would be stored into a particular location. After the save operation we want to close the untitled sketch automatically(Right now in Adobe, Untitled Sketch and saved sketch kept as opened). We call the following api to close the untitled sketch(currently kept as  opened).  But after calling the api, we got a popup that “Save changes to Adobe Illustrator document “Untitled-1” with the button Yes, No and Cancel. Actually we don’t want to display the popup. How can we achieve?

AIDocumentHandle handle = NULL;

      sAIDocument->GetDocument(&handle);

      sAIDocumentList->Close(handle);

Regards,

Avudai

This topic has been closed for replies.
Correct answer tarun_aggarwal

Use  sAIDocument

->SetDocumentModified(false); before closing the document

~Tarun

3 replies

tarun_aggarwalCorrect answer
Participating Frequently
August 21, 2009

Use  sAIDocument

->SetDocumentModified(false); before closing the document

~Tarun

TheDollarBill
Known Participant
August 21, 2009

I also thought that SetDocumentModified might help, but I'm not sure that it will work to supress the "save as" on a document that's never been saved before.  It might work, I've just never used it in that exact instance.

TheDollarBill
Known Participant
August 20, 2009

I suppose you could use the Action Manager Suite to do a PlayActionEvent with the kSaveDocumentAsAction (in the native AI format) so that you are manually doing a "save as" without displaying the dialog.  That way, when you close the file it won't ask you to save because you just did.

Inspiring
August 20, 2009

I'm assuming CS3/4 here:

// Get the current user interaction state

ASInteractionAllowed interactionAllowed = sASUserInteraction->GetInteractionAllowed();

// Set the user interaction state to never interact

sASUserInteraction->SetInteractionAllowed(kASInteractWithNone);

// Close our document

AIDocumentHandle handle = NULL;

sAIDocument->GetDocument(&handle);

sAIDocument->Close(handle);

// set the user interaction state back to what it was

sASUserInteraction->SetInteractionAllowed(interactionAllowed);

Acquire the User Interaction suite with kASUserInteractionSuite and kASUserInteractionVersion.

I've not actually used this suite myself so please report back if it works

August 20, 2009

Hi Wayne,

Thanks for your update.

I am using CS3. I tried your code. But now I am getting Adobe Illustrator Save As popup dialog. I don't want to display that dialog as well. What should I do. Help me in this regard.

Regards,

Avuds