Welcome, Guest. Please Login
Rorohiko Workflow Resources
  Welcome the Message Board of Rorohiko Workflow Resources. To register, please e-mail [email protected] - automatic registration has been turned off because of relentless spambots and spammers. This Message Board is not actively monitored. If you have an urgent question, please e-mail [email protected]. If you post it here, it will probably be many weeks before we notice.
  HomeHelpSearchLogin  
 
Page Index Toggle Pages: 1
Send Topic Print
APID - Prevent user from ungrouping or deleting (Read 8062 times)
weller
YaBB Newbies
*
Offline


I Love YaBB 2!

Posts: 10
APID - Prevent user from ungrouping or deleting
10/12/08 at 22:55:30
 
Hi
I'm trying to "disable" delete or ungroup command on certain InDesign objects. I thought that all that needs to be done is to set the observer to subjectDeleted and the attached script to Code:
alert("Don't even try this"); 


The event makes the script run but the delete or ungroup operation happens.
My second attempt was to add Code:
app.undo() 

at the end of attached script. This might work (it didn't in my case, but that's probably an issue of my poor ExtendScript knowledge) but I hope there is more elegant solution.

So my question in a nutshell is:
How to cancel the effect of action that sent an event to the observer?


Thank you
weller
Back to top
 
 
IP Logged
 
Harbs
YaBB Newbies
*
Offline


Kris Does Great Work ;-)
!

Posts: 13
Gender: male
Re: APID - Prevent user from ungrouping or deleting
Reply #1 - 10/12/08 at 23:32:45
 
For most objects a simple duplicate() should do what you want. If there's threaded text frames, it'll be a bit more complicated (you'll have to rethread the story, etc.). For ungrouping you'll probably going to want to set an idle event and regroup on idle. (although, if the user is very quick, that might not work...)
Back to top
 
WWW  
IP Logged
 
Kris Coppieters
YaBB Administrator
*****
Offline



Posts: 181
New Zealand
Gender: male
Re: APID - Prevent user from ungrouping or deleting
Reply #2 - 10/13/08 at 06:14:47
 
Hi Weller,

Main thing about APID - it has NO facilities stop stop events from happening; it's all about notification, not about control. Internally, APID watches InDesign as the user works with it, and it keeps track of what is being done, and it sends events to your event handlers accordingly.

But it cannot stop the events from happening - in that respect it's a spectator, not a controller.

Maybe you can do something with 'locking' - i.e. you can lock objects against being modified. You could have a 'subjectModified' event handler that reinstates the lock each time the user unlocks the object - so deleting or ungrouping becomes impossible until your script allows the lock to be removed?

Back to top
 

Kris
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print