[JS CS3] disappearing page items
Now this is strange: I've written a script that does some imposition of a an image on a single sheet (page) and puts some special printers marks along the side. Now there's (as far as i am aware of) one instance where all the page items get placed on the page, but when you save, close and reopen the document, half of them are gone!
When you drag the page items before saving they disappear right from under your cursor! I've tried putting a lot of save commands during the script, hoping that that would nail those items down, but with no luck.
Has anybody had a similar experience and found a solution?
Thanks,
james
Hi,
You should send your script then we could have a try on our side.
Loic
Similar Messages
-
[AS][CS3] duplicate page items in a specific position on another doc
Hello,
I need to copy or duplicate page items of the active page of doc 1 in a specific position of the active page of doc 2.
I can duplicate the page items of doc 1 into the doc 2 (with the code below) but can't find a way to duplicate them in a specific position: they are always duplicated in the same position on the active page of doc 2.
The current working code (simplified) is:
tell application "Adobe InDesign CS3"
tell document 1
tell layout window 1
set pageitemlist to every page item of active page
end tell
end tell
duplicate pageitemlist to the active page of layout window 1 of document 2
end tell
Thanks for your help!-- This works in CS4:
tell application "Adobe InDesign CS4"
tell document 1
tell page 2
set d to duplicate page item "textframe1" -- the text frame labeled "textframe1"
-- FYI, d has a class of list:
-- "text frame id 328 of page id 237 of spread id 232 of document "Untitled-2" of application "Adobe InDesign CS4""
end tell
move d to page 4 -- moves to 0,0 on pg4
end tell
end tell -
CS3: Rotated page item: How can I get the top-right point
Hi
I have a rotated page item. Now I should have the top-right and the bottom left point. If I get the rectangle of this page item I only have the top-left and the bottom-right point. And I can read the rotation angle.
- How can I get the missing points?
Thanks
HansAlgorithmically speaking (ie, this is NOT real code), isn't it just something like:
if page.rotationAngle == 90 then
origTopLeft = (newBottomRight.Y, newTopLeft.X);
else if page.rotationAngle == -90 then
origTopLeft = (newTopLeft.Y, newBottomRight.X);
else if page.rotationAngle == 180 then
origTopLeft = newBottomRight;
else
origTopLeft = newTopLeft; -
[CS3 Server] Page items copy problem
I'm trying to copy page items from one document to other. I use kCopyCmdBoss command.
Command processes successfully but extra pages are generated in destination document and InDesign fails after opening it.
What could be a problem?
Thanks in advance.-- This works in CS4:
tell application "Adobe InDesign CS4"
tell document 1
tell page 2
set d to duplicate page item "textframe1" -- the text frame labeled "textframe1"
-- FYI, d has a class of list:
-- "text frame id 328 of page id 237 of spread id 232 of document "Untitled-2" of application "Adobe InDesign CS4""
end tell
move d to page 4 -- moves to 0,0 on pg4
end tell
end tell -
[AS CS3] Bug? All Page Items - grouped items w labels
Can anyone confirm this behaviour for me. I would classify it as a bug, but maybe the logic for it not being a bug escapes me.
The command "all page items" is supposed to return a (flat) list of every page object, right? I would suspect that I should be able to address any object in the list. But I can only seem to address an object when it's inside of a group.
I am trying to get the text of a text frame that has a label. It may or may not be inside a group. I can certainly do a try/error block to try a script statement for objects in a group or not in a group. But I think that "all page items" should be able to handle it directly.
Here's a test script: ------
tell application "Adobe InDesign CS3"
tell document 1
get label of all page items
set myUngrouped to contents of text frame "some label" --only works when objects ungrouped, this is expected
set myText to (get contents of text frame "some label" of all page items)
--both statements work ONLY when objects grouped
set myText to (get contents of every page item of all page items whose label is "some label")
end tell
end tell
Steps:
Make a new document.
Draw a text frame. Type some text into it.
Label the frame "some label".
Draw another empty graphic or text frame.
Run script
-->result is, myText statements error out. Why is this?
Now group all items on page.
Run script.
-->result is, myUngrouped can't continue. This is expected.
Comment out myUngrouped statement
Run script.
-->result is, myText statements work OK.On 19/8/08 1:14 AM, "SuperMacGuy" <[email protected]> wrote:<br /><br />> set myText to (get contents of every page item of all page items whose label<br />> is "some label") <br /><br />The syntax is a bit tricky. The key is that all page items returns a list,<br />so what you want is certain items -- not page items -- from that list. So:<br /><br />set myText to (every item of all page items whose label is "some label")<br /><br /><br />-- <br />Shane Stanley <[email protected]>
-
Align page items (AS) (CS3)
Scripting Gurus,
Is there some simple AS syntax to align selected page items on a page?
Dictionary seems to imply that, saying:
align distribute items page item : The page items to align or distribute.
align option left edges/top edges/right edges/bottom edges/horizontal centers/vertical centers : The type of alignment to apply.
I attempted this:
tell page items in selection
set vertical alignment to top edges
end tell
Thanks!
JoeIts kinda of crazy but here ya go, I wish the AppleScript Dictionary listed examples ...esp. when the syntax is wacky.
select a bunch of images, or have the object references in a list(I just use selection to make it easier):
tell application "Adobe InDesign CS3"
tell active document
set myimages to selection
align align distribute items myimages align option left edges
end tell
The text in the red is where you put those paramaters listed in the dictionary.
~Mike -
[CS3 JS] Getting a page item by its script label
I have a text frame on a master page with its script label set. In my script, I am trying to get a reference to the text frame with this:
var doc = app.activeDocument;
var spread = doc.masterSpreads[0];
var tabFrame = spread.allPageItems.item("TabLeft");
I get the error "spread.allPageItems.item is not a function"
Any help will be appreciated. Thanks.
RickHi Rick,
spread.allPageItems returns a flattened array of all of the page items in the spread, at any level of the hierarchy (i.e., inside groups and other page items). Is that what you want? Sadly, allPageItems does not benefit from the special case where we use the label as a name, so you'll have to iterate if that's what you want.
As Peter says (thanks, Peter!), spread.pageItems.item("label") gives you all of the page items whose label matches the string, but it does so in sort of a weird way--you'll always get a page item object. If no page items match, you get an invalid page item; if one matched, you get a single page item, and if multiple page items matched, you get a page item object that actually contains multiple page items. It can take a little testing to figure out exactly what it is that was returned.
Thanks,
Ole -
[CS3] Stroke Type of an page item?
Hello!
Does anybody know how to get the stroke type of an page item?
There are so many possibilities.
Thanks,
Alois BlaimerHello!<br /><br />I have found somenthing:<br /><br /> // Inspect dash.<br /> InterfacePtr<IDashedAttributeValues> dashedAttributeValues(static_cast<IDashedAttributeValues*>(descriptor->QueryAttribute(kDa shedAttributeValuesBoss, IDashedAttributeValues::kDefaultIID)));<br /> if (dashedAttributeValues != nil) {<br /> SNIPLOG(" dashedAttributeValues");<br /> for (int32 i = 0; i < dashedAttributeValues->NumValues(); i++) {<br /> SNIPLOG(" [%d] %f", i, ::ToDouble(dashedAttributeValues->GetValue(i)));<br /> }<br /> }<br /><br />But the problem is, it always returns "12". I change the stroke style and it always returns "12".<br /><br />What's wrong with the code?<br /><br />Thanks,<br />Alois Blaimer
-
CS3/CS4 - Preview of page item = Crash in rare cases
Hi,
I'm wondering about how the to draw a preview of a page item, in the most correct way. Currently im using the SnapshotUtils like:
SnapshotUtils ex(somePageItemRef,scaling,scaling);
And then:
AGMImageRecord* fpCurAGMImage = (AGMImageRecord*)ex.CreateAGMImageAccessor()->GetAGMImageRecord();
to obtain an AGMImageRecord that I can draw onto an IGraphicsPort:
PMMatrix theMatrix; // No transform
gPort->image(fpCurAGMImage, theMatrix, 0);
However, one customer(PPC Mac 10.4 CS4) had a crash in this code, as seen from the partial stack trace below:
Thread 0 Crashed:
0 AdobeAGM 0x01417418 AGMTerminate + 4143764
1 AdobeAGM 0x012b645c AGMTerminate + 2697944
2 AdobeAGM 0x012bc3e8 AGMTerminate + 2722404
3 AdobeAGM 0x012be210 AGMTerminate + 2730124
4 AdobeAGM 0x0120b8d4 AGMTerminate + 1998672
5 AdobeAGM 0x01030150 AGMTerminate + 51148
6 ...adobe.InDesign.AppFramework 0x114f48c8 GetPlugIn + 118040
7 ...adobe.InDesign.AppFramework 0x114f4b30 GetPlugIn + 118656
8 com.adobe.InDesign.MyPlugin 0x0e405778
MyCustomView::Draw (IViewPort*, __HIShape*) + 1560
I can see in the documentation that the GetAGMImageRecord function should not be called any more as of InDesign 3.0, however I cannot figure out another way of obtaining an object that i can draw onto the IGraphicsPort? Is there a more preferred solution?
I Hope somebody can help on this one
Thanks!
Kind regards TokeHi Toke,
I do not have any experience with this sort of stuff ;-(
However have you noticed the sdk sample transparencyeffect which still uses GetAGMImageRecord even with CS4. Maybe the sample code sheds some light on your problem.
Best,
Peter Schülke -
CS3 / Win: Observe copy/paste action of a page item
Hi
I like to observe the manual copy and paste of a page item.
How can I do that?
What do I have to attach to the observer?
I get the action kAddToHierarchyCmdBoss and kNewPageItemCmdBoss when I copy and paste a page item. this works.
Now the problem:
In the text story of my page item there is a table. I can get the number of tables and the ITableModel of the text story in my application, thats not a problem. But I can't get the ITableModel in my observer (kAddToHierarchyCmdBoss ) if I paste the page item. The interface is always nil. I don't know why and I am looking for a solution.
Maybe the text story is not finished when I get the kAddToHierarchyCmdBoss.
Is it possible to observe if a text story is finished? I mean the copy of a text story is finished.
Thanks a lot.
Kind regard
HansI am checking in myDocObserver cmd->GetCommandState() == ICommand::kDone?
-
[CS3] How to get whether a UID is a spread, page, page item?
Hello!
I have an UID.
How can I get whether behind the UID is a spread or a page or a page item?
Alois BlaimerYou can't.
If you have a database for that UID though, you can use database->GetClass(myUID) ...
Rather than dispatching on the class ID, you better identify your required interfaces on the boss. Instantiate them (again using db+id) and if those do not exist navigate around in IHierarchy or give up gracefully. Note there are some more boss classes and stranger arrangements than you initially know - master spreads, groups, standoff, inline items, multicolumn text and so forth.
Dirk -
How to get UIDRef of the selected page item in indesign cs3
Hi,
I want to get the UIDRef of the selected page item like Rectangle Frame. Can you show me the complete code snippet to get the UIDRef of selected Rectangle Frame. I need this UIDRef for getting the geometric bounds properties(width and height) of the selected rectangle frame to display the user in dialog box.
Regards,
K.Saravanan.Hi,
UIDList selection;
InterfacePtr<ISelectionManager> pSelectionManager(Utils<ISelectionUtils>()->GetActiveSelection(), ISelectionManager::kDefaultIID);
if(pSelectionManager == nil){
break;
InterfacePtr<ILayoutTarget> pLayoutTarget(pSelectionManager->QueryConcreteSelectionBoss(kNewLayoutSelectionBoss), ILayoutTarget::kDefaultIID);
if(pLayoutTarget == nil){
break;
selection = pLayoutTarget->GetUIDList(kDontStripStandoffs);
Then, you can use this interface "IGeometry" to get information about spline size.
InterfacePtr<IGeometry> pGeometry(selection.GetRef(i), IGeometry::kDefaultIID);
if(pGeometry== nil){
break;
PMRect splineBounds = pGeometry->GetStrokeBoundingBox();
PMReal width = splineBounds.Height();
PMReal hight = splineBounds.Width();
Regards, -
Text wrap on Master Page items
RE: InDesign CS2 on Windows Vista
Hello,
I inserted a graphic on both of my master pages and applied a text wrap to them. However, on my document pages, my text does not wrap around the graphics. (In the Text Frame Options dialog box, the "Ignore Text Wrap" box is not checked.) I know I can either override my master page items (and insert the graphic again) or control-shift-click on the graphic and force the text to wrap around it. But that puts another link to the graphic in my document...and I'm trying to minimize the file size.
Do you have any ideas on how to make the text wrap on the master pages work on the document pages?Text wrap on masters is not honored on live pages in CS2. It was added as feature in CS3.
Bob -
Button condition on page item and Validation error Conflict
Hi,
I have a select list page item and a button on page whose condition is based on the select list page item value(eg, If (:P2_item1='val1'){return true;}) with condition type=PL/SQL function returning boolean. This buttons submits the page.
It' coming fine in normal case. However, if I select some value val2 from the list and then click the button, and if there are any validation errors (like mandatory check or email check fail etc), then the button disappears because it evaluates the button condition based on the changed value(val2), but the page has not yet been submitted because of validation errors.
I think this can be solved if I create the button condition based upon database column value instead of page item as db col value won't change until the page is submitted.
This look like very basic use-case and I would like to know if there is any better solution to this problem.
Note: I am using Apex 4.2.1I don't want to show/hide the button on the change of the page item lov value, so i am not using Dynamic action.
What i was is to make button visible based on a condition(which is based on page item), for which we have condition attribute of a button available.
This is a very common thing where a user chooses the button condition as Value of item/column in expression 1 is null/expr2. But what if the user changes the page item value but it doesn't get submit due to validation error. In that case, the button condition fails.
So, i guess i have to use column name in expression 1, can u tell how to do that?
Expression 1 = IF (:P2_STATUS='val1') then return true;
How to change the above to use db column 'status' instead? Any direct way(like #Status#) or I have to query db to get it using select.
Any alternative approach? -
[AS] Change Colour of all page items on layer
Hi
I am trying to set up a script to change the colour of fill, stroke and text of page items on one layer, and having very little luck, what I have so far is below, as it stands I seem to only be creating the swatch, could I get a few pointers on how to do this correctly please?
I have three attempts as below, which return pretty much the same result, nothing?
(1)
tell application "Adobe InDesign CS3"
set myDocument to active document
activate
tell document 1
try
set _Swatch to make color with properties {name:"PANTONE Blue 072 U", color:spot, color value:{100, 88, 0, 5}, model:spot}
set _NewColour to swatch "PANTONE Blue 072 U"
set swatch _NewColour to every page item whose fill color is swatch "Black"
set swatch _NewColour to every page item whose stroke color is swatch "Black"
end try
end tell
end tell
(2)
tell application "Adobe InDesign CS3"
set myDocument to active document
activate
tell document 1
try
set _Swatch to make color with properties {name:"PANTONE Blue 072 U", color:spot, color value:{100, 88, 0, 5}, model:spot}
set _NewColour to swatch "PANTONE Blue 072 U"
set _Colour to swatch "Black"
set _Fill to every page item whose fill color is swatch "Black"
set _Fill to _NewColour
set _Stroked to every page item whose stroke color is swatch "Black"
set _Stroked to _NewColour
end try
end tell
end tell
(3)
tell application "Adobe InDesign CS3"
set myDocument to active document
activate
tell document 1
try
set _Swatch to make color with properties {name:"PANTONE Blue 072 U", color:spot, color value:{100, 88, 0, 5}, model:spot}
set _NewColour to swatch "PANTONE Blue 072 U"
set _Colour to swatch "Black"
set _Fill to every page item whose fill color is swatch "Black"
set _Stroked to every page item whose stroke color is swatch "Black"
set _All to _Fill & _Stroked
set swatch of _All to swatch _NewColour
end try
end tell
end tell
Cheers
KevTry this:<br /><br />tell application "Adobe InDesign CS3"<br /> set myDocument to active document<br /> activate<br /> tell document 1<br /> try<br /> set theLayer to layer 1 -- or whatever<br /> set _Swatch to make color with properties {name:"PANTONE Blue<br />072 U", color:spot, color value:{100, 88, 0, 5}, model:spot}<br /> set _Colour to swatch "Black"<br /> set fill color of every item of all page items whose fill color<br />is _Colour and item layer is theLayer to _Swatch<br /> set stroke color of every item of all page items whose stroke<br />color is _Colour and item layer is theLayer to _Swatch<br /> end try<br /> end tell<br />end tell<br /><br />-- <br />Shane Stanley <[email protected]>
Maybe you are looking for
-
Hi, I wanted to create new variable for a query. But I could not find the Maintain Variable in Sap menu..I found only the following.SAP menu->Business Explorer->Analyzer. Is there any procedure to include 'maintain variable' in SAP menu->Business
-
I've had my iPod touch for 4 years, never had a problem with my contacts but in last 2 weeks they have been completely erased twice. The first time I lost everything and had to start again as I allowed my ipod to resync with itunes before I realised
-
I need help re-installing CS4 production premium (for PC). Error code says "Installation database is corrupt" but if I try to delete the caps.db file I can't even find one. Furthermore, I tried Adobe Cleaner and it made no difference. HELP!
-
Virtual Machine Manager Setup Wizard is hanging
Appears to be 4/5 of the way done (4 of 5 bars are blue). Installing features. Green bar continues to zip across over and over. Installing VMM Console. Been sitting like this for some time now.
-
Pacman cannot reach mirrors [solved]
I tried to update my computer and this is what my command and output was. mjuszkie@carbon ~ % sudo pacman -Syu :: Synchronizing package databases... error: failed retrieving file 'testing.db' from mirror.vtti.vt.edu : Connection timed out after 10000