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 - "modified-text" event for cells' contents (Read 10443 times)
weller
YaBB Newbies
*
Offline


I Love YaBB 2!

Posts: 10
APID - "modified-text" event for cells' contents
06/12/08 at 07:05:31
 
Is there a way to run script when user types into table cell?

Thanks for help
weller





Great work Kris. Adobe should ship APID with every copy and pay you 100% price for each license sold. Or you should charge twenty times more for it. (Just wait coupla days with the price rise until I'll upgrade to APID for CS3 please)
Back to top
 
 
IP Logged
 
Kris Coppieters
YaBB Administrator
*****
Offline



Posts: 181
New Zealand
Gender: male
Re: APID - "modified-text" event for cells' conten
Reply #1 - 06/12/08 at 09:01:02
 
Hi Weller,

Thanks for the appreciation!

Handling that should work via an observer object - i.e. set up a separate observing page item (or scripted plug-in proxy like APIDTemplate provides), and set the event filter to 'subjectModified-usertyping' or 'subjectModified-text', and subject list to '*'.

Each time a cell (or anything else) is typed in, you'd get this event. Your script would still need to figure out whether the typing occurred in a table, what cell and so on - probably from app.selection - which would be an InsertionPoint at that time...

Does that help?

Cheers,

Kris
Back to top
 

Kris
WWW  
IP Logged
 
WellerUK
YaBB Newbies
*
Offline



Posts: 5
Re: APID - "modified-text" event for cells' conten
Reply #2 - 06/13/08 at 00:11:37
 
Thanks Kris
It works perfectly. I've noticed that there's no 3000ms delay which is usual on regular text frames. I tried to fiddle with $.sleep() function, but that will only slow the script execution. What I need is to allow the user to type few characters before the script will take command over InDesign.

Thanks
Back to top
 
 
IP Logged
 
Kris Coppieters
YaBB Administrator
*****
Offline



Posts: 181
New Zealand
Gender: male
Re: APID - "modified-text" event for cells' conten
Reply #3 - 06/13/08 at 11:27:00
 
Hi WellerUK,

That is easy to accomplish, I think. Check the code sample below - I have a frame on the pasteboard, which has its list of subjects set to "*", and its event filter to "selected,subjectModified-usertyping" so it reacts to being selected, and on any of its subjects being typed into.

The script is:


if (theItem.eventCode == "selected")
{
  theItem.setDataStore("$DELAY_subjectModified-usertyping$",3000);
}
else
{
  alert("Typing");
}


So when I select the page item on the pasteboard it sets a predefined data store entry which is the delay value for the subjectModified-usertyping event on that page item. This way, if the user types away, nothing happens, until the user pauses for 3 or more seconds.

That should do the trick, I hope...

Cheers,

Kris
Back to top
 

Kris
WWW  
IP Logged
 
WellerUK
YaBB Newbies
*
Offline



Posts: 5
Re: APID - "modified-text" event for cells' conten
Reply #4 - 06/13/08 at 20:50:48
 
Thanks Kris

It did the job. I've found it in the documentation later but it was too late because I'd already bothered you with stupid RTFM question. Sorry for that.

Thanks for help
weller
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print