Copy link to clipboard
Copied
Hi All,
I have tried the following two options to activate the layer on InDesign Server side. But it does not work on server side.
1. By using JavaScript
app.activeDocument.activeLayer = app.activeDocument.layers.item ('LayerName');
I have created the above script programatically by using Adobe InDesign CS4 SDK (version 557). When I run the program it gets hang when this script get executed on server side. It gives me the Error like "Object does not support the property or method 'activeDocument' ".
But when I run the same script with InDesign CS4 Desktop application then it runs properly. The layer (i.e layer name) get activated on InDesign Document.
2. By using Command
I have created command using "kSetActiveLayerCmdBoss".
Then I get ILayoutCmdData Interface pointer from ICommand. But when I try to derived the
ILayoutControlData ptr it gets as nil.
It works properly on InDesign Desktop Application but not on InDesign Server Application.
So please help me into this problem. Its very urgant.
Thanks & Regards,
Santosh Kadam.
Copy link to clipboard
Copied
There is no 'active document' on the server - there is no user interface, all you have is a number of open documents, none of them 'active'. So anything that has to do with windows, something being active, something being selected,... is not applicable to the server.
On the server you'd need to do something that's a variant of:
var theDoc = app.documents[0]; // might need to loop, use an index,... all depends
var theLayer = theDoc.layers.item ('LayerName');
... do stuff with the layer ...
Cheers,
Kris
Copy link to clipboard
Copied
Hello Kris,
Thanks for the quick response. With what you have mentioned below I can get the Layer ID or specific layer. But how can I activate that particular layer from the Layer Name or its ID ( or UID ) as i did not find anything specific under the object library for Layers/Layer.
Thanks & Regards
Santosh.
Copy link to clipboard
Copied
I am not sure what you are asking?
The thing to do is launch ExtendScript Toolkit, and look at the Object Model for the server, and see what is or is not available on the server (as opposed to the object model for the desktop app). I had a quick look at the CS3 server object model (don't have a CS4 version readily installed here) - document.activeLayer is available on the server - so that one should work.
Cheers,
Kris
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more