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

Prevent Document close by close(x) using startup Script

New Here ,
Aug 30, 2010 Aug 30, 2010

Hi,

     Im developing a startup script to control of document close using the close(x) icon of the document.can anyone help me???

TOPICS
Scripting
1.0K
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 ,
Aug 30, 2010 Aug 30, 2010

It's not possible to control windows components through scripting.

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 ,
Aug 30, 2010 Aug 30, 2010

Hey!

It's possible to disable closing document.

Try this:

#targetengine disableItems

var disableClose = app.activeDocument.eventListeners.add("beforeClose", stopMenuEvent);
function stopMenuEvent(stopMenuEvent){
    alert("Sorry, you can't close this document!","Closing disabled!");
    stopMenuEvent.stopPropagation();
    stopMenuEvent.preventDefault();
}

Hope it helps!

This works just with CS5.

--

tomaxxi

http://indisnip.wordpress.com/

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 ,
Aug 30, 2010 Aug 30, 2010

Yes, that traps Close in the File menu ... but does it also work with the box? (Sorry -- no CS5 nearby, otherwise I'd just try it.)

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 ,
Aug 30, 2010 Aug 30, 2010

Yes, it does. If even catches application close.

--

tomaxxi

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 ,
Aug 30, 2010 Aug 30, 2010

Yes, I have tested on Mac and its working fine with CS5.

Its stoping command execution in CS4 too but showing error after that.

Shonky

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 ,
Aug 30, 2010 Aug 30, 2010

I need to control the close(x) icon of the document & not the file menu close

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 ,
Aug 30, 2010 Aug 30, 2010

It controls (x) icon also, but just in CS5.

--

tomaxxi

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 ,
Aug 30, 2010 Aug 30, 2010

Is it possible to do in cs4

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 ,
Aug 30, 2010 Aug 30, 2010

I think no.

--

tomaxxi

http://indisnip.wordpress.com/

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 ,
Aug 30, 2010 Aug 30, 2010
LATEST

Is there any other way to do it?

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