Copy link to clipboard
Copied
Hi,
Im developing a startup script to control of document close using the close(x) icon of the document.can anyone help me???
Copy link to clipboard
Copied
It's not possible to control windows components through scripting.
Copy link to clipboard
Copied
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/
Copy link to clipboard
Copied
Yes, that traps Close in the File menu ... but does it also work with the
Copy link to clipboard
Copied
Yes, it does. If even catches application close.
--
tomaxxi
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I need to control the close(x) icon of the document & not the file menu close
Copy link to clipboard
Copied
It controls (x) icon also, but just in CS5.
--
tomaxxi
Copy link to clipboard
Copied
Is it possible to do in cs4
Copy link to clipboard
Copied
I think no.
--
tomaxxi
http://indisnip.wordpress.com/
Copy link to clipboard
Copied
Is there any other way to do it?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now