-
1. Re: Adding section to active page
John Hawkinson Aug 21, 2011 4:57 PM (in response to Petteri_Paananen)Does it work better with?:
var numero = app.activeDocument.layoutWindows[0].activePage.name;
just a guess.
-
2. Re: Adding section to active page
Petteri_Paananen Aug 21, 2011 8:58 PM (in response to John Hawkinson)No, it gives me same alert... thanks anyway....=)
-
3. Re: Adding section to active page
Harbs. Aug 22, 2011 1:51 AM (in response to Petteri_Paananen)I have not played with Configurator much.
One thing you can try is using app.documents[0] instead of activeDcoument.
You can also wrap the whole thing in a try/catch. This would probably solve both of your issues in one go...
Harbs
-
4. Re: Adding section to active page
John Hawkinson Aug 22, 2011 4:52 AM (in response to Harbs.)In case it wasn't clear, if you
try { ... } catch (e) { $.writeln("Error "+e.message+" at line "+e.line); }then you'll know what it is complaining about, instead of being a mystery.
-
5. Re: Adding section to active page
Petteri_Paananen Aug 22, 2011 9:12 AM (in response to John Hawkinson)Thanks guys...=) but no luck here....
And I noticed something quite weird. This script is meant to use with single pages, but when I accidentally used it with facing pages spreads, I got that same alert + script changed the way page numbers are marked below thumbs:
It replaced 10-11 with 10,11
I also tried
try {
var myDoc = app.documents[0];
var numero = app.documents[0].layoutWindows[0].activePage.name;
var numero2 = numero -1;
myDoc.sections.add(myDoc.pages[numero2]);
} catch (e)
{ $.writeln("Error "+e.message+" at line "+e.line);}But I still have that same alert.... When I run that code in Extend Script ToolKit, I got following javascrip console message:
Error undefined is not an object at line 2
Result: undefined -
6. Re: Adding section to active page
Laubender Aug 22, 2011 2:04 PM (in response to Petteri_Paananen)It replaced 10-11 with 10,11
Petteri,
nothing weird here: 10-11 means, that the whole spread belongs to a single section.
Now, after adding a new section at page 11, InDesign indicates with the comma between the page numbers that the spread belongs to two sections.
A second indicator is the tiny triangle at top of page 11.See also the following screen shot where one spread contains 4 pages and is part of three sections:
Uwe
Message was edited by: Laubender
-
7. Re: Adding section to active page
John Hawkinson Aug 22, 2011 7:38 PM (in response to Petteri_Paananen)try {
var myDoc = app.documents[0];
Error undefined is not an object at line 2
Well, clearly you don't have an app.documents[0];. Perhaps app is wrong, or app.documents is wrong. So try printing out a bunch of these things to find out. Check app.reflect.properties and app.documents.length and all that stuff... Maybe even try BridgeTalk (shudder).
-
8. Re: Adding section to active page
Petteri_Paananen Aug 22, 2011 10:37 PM (in response to John Hawkinson)@Laubender
Thanks for the clarification...=) InDesign is amazing peace of software, I have used it since version one (and even written 4 books about it) and still sometimes I learn something new. I have used sections many many times but I have never noticed that behaviour...
@John
I have to study this little further. My problem is that I´m really a newbie with javascript. I have done quite a lot ActionScript but it´s just different enough to drive me crazy sometimes...=)
Thanks anyway to everyone.....





