Skip to main content
Participant
December 4, 2009
Question

RO mode or Closing within AIDocumentOpened Notification

  • December 4, 2009
  • 1 reply
  • 599 views

Hi,

We have a plugin where we are implementing a check-in, check-out system in AI.

There is one big issue with this. I have not found a way to open a file in read-only mode within AI.

Best we got was to set the file attributes to RO but it is too easy to overcome.

The next best solution would be to immediately close the file after determining it is not available.

The issue here is that we can't call sAIDocument->Close() within the AIDocumentOpened notification call or AI will crash.

Has anybody found solutions or workarounds for this ?

Thank you

Christian

This topic has been closed for replies.

1 reply

A. Patterson
Inspiring
December 4, 2009

This is kind of hacky, but you could try creating a timer with a period of zero. That means AI will fire the timer response the next chance it gets, which will be immediately following the open notifier. So you might be able to create a timer just for closing-following-open and respond there with a Close().

Rick E Johnson
Inspiring
April 30, 2017

Thanks, Andrew! I'm now working on a similar project, was having similar close-on-open issues, and the timer trick worked perfectly! Like Christian, I wish I could somehow have the option to open a doc in read-only mode or to cancel an attempt to save, but I believe they're concessions I'll just have to accept. Thanks for saving an otherwise cancelled project! -- Rick