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
docLoad event called for every file opened (Read 8864 times)
Conrad
YaBB Newbies
*
Offline


I Love YaBB 2!

Posts: 6
docLoad event called for every file opened
04/05/11 at 22:55:10
 
We're in the process of re-writing some externally developed plug-ins for InDesign CS to run in CS5. One of the things these plug-ins do is resize a document to a specific size when the document is opened. It looks like APID might do what we need it to do but I've been through the cookbook and reference manuals and, while I'm able to create and deploy compiled scripts that fire when a specific InDesign document is opened I need it to fire when any InDesign document is loaded.

Currently I'm doing this via a user executed VBS file, we'd like to automate this.

I'm struggling to understand exactly how I get the docLoaded event to fire when not attached to a specific object or proxy object.

I'm probably missing something simple but a pointer in the right direction would be appreciated.

Also, I was under the impression that I would be able to create and compile scripts using VBS. This doesn't appear to be the case, can someone confirm this? I've been able to make use of the extensions to ExtendScript (createProgressBar for example) but the compiler only seems to accept files of type .js or .jsx.

I currently have some pretty comprehensive scripts written in VBScript, being able to call those from a registered menuItem would be useful, is that possible? An alternative would be to register a new menuItem using JavaScript which calls a JavaScript function which, in turn, calls myVBS file.

I hope I've been clear!

Thanks in advance,

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



Posts: 181
New Zealand
Gender: male
Re: docLoad event called for every file opened
Reply #1 - 04/05/11 at 23:14:38
 
Hi Conrad,

To achieve what you want, you need to use a .spln ('Scripted Plugin') file - you cannot do it with just a compiled script. To create a .spln, you should start by opening the APIDTemplate.indd file.

Make the .spln react to the docLoaded event, and you then have code that will execute for every document that's opened. There's info and sample code about all this in the cookbook.

Essentially, one of the text frames you'll find in the APID Template is a temporary 'stand-in' for the .spln file - any events you 'direct' to this text frame will be the events that will be captured by your .spln file.

Most of the ToolAssistant extensions to the scripting DOM are accessible from VBS, but in practice, APID ToolAssistant is made to work with ExtendScript, and all you get from VBS is access to the lower-level stuff in APID ToolAssistant. The higher-level stuff like compilation and APIDTemplate.indd are pretty ExtendScript-specific. You could probably wrap your VBS inside an ExtendScript, but it'd be a kludge.

Cheers,

Kris
Back to top
 

Kris
WWW  
IP Logged
 
Conrad
YaBB Newbies
*
Offline


I Love YaBB 2!

Posts: 6
Re: docLoad event called for every file opened
Reply #2 - 04/06/11 at 01:20:22
 
Thanks for that, that's great. I've now been through the same example in more detail and seen what I was missing. I was trying to get the extendscript into one of the textframes in the sample document, not the external jsx file. I've changed that and it's now working.

My problem is now centered around the running of my complex VBS files. Here's an example:

A user clicks on a link in an ASP page that does some pre-processing and then opens an InDesign document in their local instance of InDesign CS5.
I want to do a query in our database which will return the correct height and width of the document (this might have been adjusted by a third party).
These measurements should be used to resize the document.

Using VBS I can do one half (the database bit) and using APID I can do the auto-resize on load.
Is it possible to return values from an external VBS file back into parameters within a jsx file?

Can you point me to instructions that would outline how to run a VBS from within a JSX file? I really just need the event handlers from the APID toolkit. Everything else (that I need) is do-able from VBS.

Thanks again

Conrad
Back to top
 
 
IP Logged
 
Conrad
YaBB Newbies
*
Offline


I Love YaBB 2!

Posts: 6
Re: docLoad event called for every file opened
Reply #3 - 04/06/11 at 02:00:58
 
Sorry for the double post but it looks like this might just be all I need:

app.doScript(File("/test.vbs"), ScriptLanguage.visualBasic);

This enables me to call vbs files and do what I need to do. Combined with the additional event handlers within APID and the extensions to the scripting DOM that are accessible to VBScript I can put together a really nice workflow.

I might be back when I come to selecting a flight-checking profile on document load and activate but for now I'm good.

Thanks very much.

Conrad
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print