[CS6] Select the block of text with a certain height and move it to a specific location?
I have a bunch of labels on page that I need to move. All these labels are the same height (0.125 in.) so what I think is that a script could go on each page and find the article on this basis, select it, and finally, move it to a specific location of XY with a right anchor point. It would be very difficult to do? I think it would be a rather simple script.
Thanks for any help you can give!
No problem getting the height of a selected image and looking for images with the same height. Here is a sample script:
(function(){ function frameHeight (frame) { var gb = frame.geometricBounds; return (gb[2]-gb[0]).toFixed(3); } function moveFrames (h) { var pItems = app.documents[0].pageItems.everyItem().getElements(); for (var i = pItems.length-1; i >= 0; i--) { if (frameHeight (pItems[i]) === h) { pItems[i].move ([0,0]); } } } if (app.selection.length > 0 && app.selection[0].hasOwnProperty('geometricBounds')) { var h = frameHeight (app.selection[0]); moveFrames (h); } }());
This move of the elements on the page with the same height as the photo selected to the top left of the page. See the move() command line 12. You can substitute your own coordinates [0,0].
Tags: InDesign
Similar Questions
-
Select the block of text on each page of a sudden and resize them
Hello, I want to do a 400 pages of text. How can I select the block of text on each page of a sudden and change their size at the same time? (each block of text is the same size per page)
Make a backup copy of the file incase something goes wrong, then:
Ensure that executives align on the margins on all sides - change margins of the master page applied to achieve, if necessary.
Allow the adjustment of the layout (layout > setting layout...)
On the master page, change the margins to be the size you want the new text frame dimensions to be.
If, for some strange reason, you won't use these margin settings in the layout, turn off the setting of page layout and reset them on the master page again to what you want.
-
Select the block of text to items found
Hi experts
Here I find etc using the character style. I found myself results. Now, what is my need I want to select the block of text for the element found.
app.findPreferences = NothingEnum.nothing;
app.changePreferences = NothingEnum.nothing;app.findPreferences.appliedCharacterStyle = "FigCallout";
var myResults = app.activeDocument.search ();
for (i = myResults.length - 1; i > = 0; i--)
{
Select the block of text where myResults [i]}
I use CS2 Windows.
Thanks in advance
concerning
a you are the
Memory: .parentTextFrame myResults [i]?
-
I can auto adjust all the blocks of text with overset text?
Due to several factors (change computers, versions of different fonts, etc.), I had to change most of the fonts in my text-heavy document.
There are a lot of charts and tables in this 125-page document, and now most of all text frames have overset text.
The new font is in fact identical to the previous one, however, there are a few differences that are causing it take more text frames. I tried to adjust the line spacing in my character and paragraph styles, but these do not seem to effect.
Is there a way to automatically adjust all frames in excess to account for the new font?
Thanks in advance.
Not sure that the result will be 100% desirable, but there is a way to define all frames to auto-size...
Run find/replace and choose the tab object.
Down, choose the Document research: menu. Choose the blocks of text such as: menu.
Click the icon of glass/frame next to the search Object Format field:
In the Options of Format object search dialog box, choose Auto setting 'Off' on the text size Options > menu automatic sizing:
Click OK, and then click the icon / window next to the subject of change Format field:
In the change object Format Options dialog box, choose 'Height' only on the text size Options framework Auto > auto-size menu, and then click the up button in the Center in the framework - pinning proxy:
Note: Another option for pinning would be better according to your presentations, but this setting will make executives grow at the bottom, which seems the most logical... in most cases.
Click OK, and then change all.
-
Select the block of text of XML structure
I try to move the specific text blocks created if an XML to import to the bottom of the page (low mounting table) as info Folio and slug.
I can choose the text associated with an XML "VTag" element, but not the text block. Any help would be appreciated.
Thank you
property myHoHoV: {}
on myLoopLoop (myElement)
Tell application "Adobe InDesign CS4"
tell the active document
the value moreElement for each XML element of myElement
Repeat with 1 x to (moreElement County)
the value of element x of moreElement em1
Select em1
If (the tag name of the em1 is "VTag1") then
em2 Set to em1
Set the properties of the display preferences {horizontal measurement units: inch, vertical measurement units: inches, origin origin: the rule page}
at the top left anchor the transform value point of reference of the window layout 1
Select text of em2
Tell application "Adobe InDesign CS4"
move the em2 text to {5, 5}
tell the end
end if
Tell me myLoopLoop (point x of the moreElement)
end repeat
tell the end
tell the end
end myLoopLoopHi Kyran,
If the previous code has a problem, then try this code below.
Tell application "Adobe InDesign CS4"
activate
the value myPageHeight at the height of the page of the preferences of the document 1 document
the value myPageWidth to the width of the page of the preferences of the document 1 document
the value myOldRulerOrigin at the origin of the rule of document 1 display preferences
the original value of the rule of 1 at the origin of the page display preferences
Set the zero point of the document 1 to {0, 0}
the value mapping page active of the active window
tell document 1
the pgcnt value to count pages
Repeat with 1-pgcnt p
tell the page p
the txtframe value to count blocks of text
Repeat with 1-txtframe f
the value paracnt to count paragraphs of text frame f
tell text frame f
Try
TagName {} Set
Repeat with 1 paracnt access point
end game of tagname to (name of the tag to (point 1 of the associate XML elements) paragraph ap) as string
end repeat
If ((comte de tagname) is equal to 1) and (each point of tagname contains "VTag1") then
Select
move to {0.125, myPageHeight + 0.125}
on the other
don't select anything
end if
try to end
tell the end
end repeat
tell the end
end repeat
tell the end
activate
Display dialog "process is complete...". "with the 1 icon
tell the endConcerning
MANi
-
Select a block of text with lable
I'm coming down with a block of text from the document page 2 with label "main script text" but script below does not work.
app.activeDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.spreadOrigin;
Try
{
var jt = app.activeDocument.pages [2] .textFrames;
for (i = 0; i < jt.length; i ++)
If (.label jt [i] is 'Hand Text')
JT [i]. TextFramePreference.autoSizingType = AutoSizingTypeEnum.HEIGHT_ONLY;
}
{catch (e)}
Alert ("nothing happened");
}
Can you please help me what is the error here.
Counting with numbers index starts with the number 0.
So the second page is app.documents [0] .pages [1].
Uwe
-
How to select a block of text to the Script name?
Hello
I have listed the text block in the code below,
UIDRef uidreference = stories->GetNthTextModelUID(0);
InterfacePtr<ITextModel> TheTextModel (uidreference, UseDefaultIID());
if (TheTextModel is NOTHING)
Break;
IFrameList * Frames = TheTextModel->QueryFrameList();
if (Frameworks is NOTHING)
Break;
AFrameUID UID = images->GetNthFrameUID(0);
I need to select the block of text by Script name (Windows-> Utitities-> Script title).
Please suggest the solution above the problem.
Try,
InterfacePtr
script (content, UseDefaultIID()); If {(script)
ScriptLabelValue = script PMString-> GetTag();
CAlert::WarningAlert (scriptLabelValue);
}
-
find and delete blocks of text with the same geometricBounds
Hi writer... .new question from here:
mySelection var = app.activeDocument.selection [0] .geometricBounds;
alert (mySelection);
throughout the document, I need search and delete blocks of text with the same geometricBounds.
If possible, the same dimensions, but not the same positions.
Thanks for the help!
OK Bala... .in to decimal differences, some executives have not been removed.
I solved with "Math.round' instead of 'number '.
===================
mySelection var = app.activeDocument.selection [0] .geometricBounds;
var myWidth = Math.round(mySelection[3]-mySelection[1]);
var myHeight = Math.round(mySelection[2]-mySelection[0]); Alert (myHeight);
var allFrames = app.activeDocument.allPageItems;
While (t = allFrames.pop ()) {}
{if (t.IsValid)}
var myTextframe = t.geometricBounds;
var myTWidth = Math.round(myTextframe[3]-myTextframe[1]);
var myTHeight = Math.round(myTextframe[2]-myTextframe[0]);
If ((myWidth == myTWidth) & (myHeight == myTHeight)) {}
t.Remove ();
}
}
}
===================
Now, your script works great!
Thank you very much!
-
by selecting all the blocks of text on all visible layers
I want to select all the blocks of text on all visible layers.
the script below will select all the blocks of text, even in groups, but if the layer with the text is invisible the script error. (target layer cannot be changed)
If (app.documents.length > 0) {}
var doc = app.activeDocument;
var numTextFrames = 0;
for (i = 0; i < doc.textFrames.length; i ++) {}
textArtRange = doc.textFrames [i];
textArtRange.selected = true;
}
}
So I made this script to select blocks of text on only visible layers, but now missing text belonging to a group.
var layerCount = activeDocument.layers.length;
var docSelected = activeDocument.selection;
for (i = 0; i < layerCount; i ++)
{
currentLayer = activeDocument.layers [i];
If (currentLayer.visible == visible)
{
for (j = 0; j < currentLayer.textFrames.length; j ++) {}
textArtRange = currentLayer.textFrames [j];
textArtRange.selected = true;
}
}
}
can someone tell me why it is not some frames of text bound in a group when made this way and is it possible to get all managers of related texts selected on all visible layers?
Thank you
Duane
Try this:
if (app.documents.length > 0 ) { var doc = app.activeDocument; var numTextFrames = 0; for ( i = 0; i < doc.textFrames.length; i++ ) { try { textArtRange = doc.textFrames[i]; textArtRange.selected = true; } catch (e) {} } }
Have fun
-
Hello
Am new to Java script.
Can someone help me out here, I need to select all the blocks of text in a document and align text blocks in the pages back to the left margin frames and text in pages recto at the right margin.
Thank you
HarishHi Harish,
Try this.
var doc =app.activeDocument, _pages = doc.pages; doc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin; for(var i =0;i<_pages.length;i++) { txfms = _pages[i].textFrames.everyItem().getElements(); for(var j =0;j
Kind regards
Cognet
-
Add points to the block of text, possible?
Is it possible to add a point to a block of text with a script?
Before:
After:
Sure. A text block is a geometric shape than any other; in InDesign, it is just a rectangle.
All geometric shapes in InDesign consist of one or more paths - all have a property "paths" as a table. Each path contains a pathPoints array and is what you would use to add a corner.
Because you can not really sure what is the lower right corner, this script does not immediately change the pathPoints. Rather, it copies the path, trying to find the corner (not sure if it is 'the way'), adds two points after that and these points moves to the Insert.
myRect = app.selection[0]; myPath = myRect.paths[0]; myPathPoints = myPath.entirePath; // Determine lower right -- not sure if it's always the same! corner = 0; for (a=1; a
myPathPoints[corner][0]) corner = a; if (myPathPoints[a][1] > myPathPoints[corner][1]) corner = a; } // Add two point 'after' corner // Use old corner point as model p1 = [myPathPoints[corner][0], myPathPoints[corner][1]]; p2 = [myPathPoints[corner][0], myPathPoints[corner][1]]; myPathPoints.splice (corner+1,0, p1, p2); // Move x of original corner point myPathPoints[corner][0] -= 5; // Move x and y of new angle point p1[0] -= 5; p1[1] -= 5; // Move y of back-to-frame point p2[1] -= 5; // Put modified path back into object myPath.entirePath = myPathPoints; -
I try to use the code below to remove all the blocks of text hidden in a document. It is works quite well, BUT for some reason, removes the visible anchor text blocks.
(the argument currentTextFrame.length is to prevent it remove hidden text blocks if the content is threaded, in which case the text is redéroule then in blocks of text that is visible.) I need to find a solution to this, but it's tomorrow problem.)
I have a similar function to allGraphics and does not remove the anchored frames.
Can someone point me in the right direction? I can add a check to see if the text block is anchored, but I fear that I might get bored the biggest problem.
var myDocument = app.activeDocument; var myTextFrames = myDocument.stories.everyItem().textContainers.reverse(); var myTextFramesLength = myTextFrames.length; for ( i = 0; i < myTextFramesLength; i++ ){ var currentTextFrame = myTextFrames[i]; if ((!currentTextFrame.visable) && (currentTextFrame.length ===1)){ currentTextFrame[0].remove(); } }
Edit: What is happening in 2014.0 and 2015.1, OS x 10.10 CC
Post edited by: Naomi Kennedy
Hi Naomi,
and there is an array of arrays with:
myDocument.stories.everyItem().textContainers
Try this:
var a = app.documents[0].stories.everyItem().textContainers; for(var n=0;n
I suggest the following, which should work:
var doc = app.documents[0]; var myStoriesArray = doc.stories.everyItem().getElements(); var storiesLength = myStoriesArray.length; var textContainersToRemoveIDs = []; for(var n=0;n
Uwe
-
Heights of game for all the blocks of text in a document
Looking to do something seemingly simple. I want all the blocks of text in my document to the same height.
Here's where I am.
app.activeDocument.textFrames.everyItem () .height = "2.3195 in."
Note: I work in InDesign CS5.
Any help on where to go from here would be greatly appreciated.
Or, in the CS6 and later*:
var NEW_HEIGHT = '2.3195 in'; // MULTIPLE RESIZE() IN ONE STEP // ============================= app.activeDocument.textFrames.everyItem().resize( // Target bounding box(es) -- Use OUTER_STROKE_BOUNDS if needed // --- [CoordinateSpaces.INNER_COORDINATES, BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS], // Reference point -- Here resize is performed relative to the top edge // --- AnchorPoint.TOP_CENTER_ANCHOR, // Absolute replacement // --- ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH, // [width, height] in points // --- [ResizeConstraints.KEEP_CURRENT_VALUE, +UnitValue(NEW_HEIGHT).as('pt')] );
* Can operate CS5. x too, but I think remember that CS4 has a bug where resize() is a plural specifier whose receptors belong to several blocks spread.
@+
Marc
-
Select all blocks of text related
Dear all,
My request:
1. is it possible to select all the text frames linked to my block of text by selecting (see attachment)
2 suppose that if we choose all the blocks of text, it is possible to set the height for all blocks of text such as 3 p or 4 p etc...
Try the script to select all the linked text frames:
If (app.selection [0] .nextTextFrame == null)
{
If (app.selection [0] .previousTextFrame! = null)
{
Alert ("Pass")
App.Select (previousTextFrame.parent) & & app.select (nextTextFrame.parent) & & app.select (startTextFrame.parent)
}
}
Could someone give you a solution for my application.
Thanks in advance
Beginner
If you want to do is make managers of related related texts have all the same height, here's a way to do it:
If (app.selection.length == 0) {}
Alert ("Please select a textFrame before running this script");
Exit();
}
mySelection var = app.selection [0];
If (!) mySelection instanceof TextFrame))) {}
Alert ("Please select a TextFrame before running this script");
Exit();
}
var mySelection.parentStory = monarticle;
var myFrames = myStory.textContainers;
var nFrames = myFrames.length;
for (ix var = 0; ix)< nframes;="" ix++)="">
var myFrame = myFrames [ix];
var limit = myFrame.geometricBounds;
delimits [2] = limits [0] + 4; Set the TextFrame 4 height units
myFrame.geometricBounds = limit;
}
Stephen
-
I am a new user. The trial version ch & LR were uploaded 2 days ago and just joined the monthly plan. However, when open the LR, there all the same show PS with one day left and trial version with 29 days. Please please Advisor and would like to know if other apps like bridge etc. are included in the plan. Thank you very much.
Maybe you are looking for
-
I have a 478 Intel Celeron® 2.80 GHz, 128K, 400 MHz FSB cpu Cache and amazing, if I can put it in my microprocessor Toshiba Satellite Pro A100 card mother ati sb450. If not, how can upgrade my cpu with, thank you
-
HP tm2-2105eg: BIOS password forgotten
Hello, I forgot my BIOS admin password. HP tm2-2105eg Disabled system [85176585] Can someone please? Thank you very much!
-
I just installed the new 2016 LabVIEW with the two patches and wanted to check the new feature. When you create a channel writer, there was a pop up select the Channel end point, but whatever the option chosen, there is a window saying "LabVIEW could
-
Vista Home Premium - Service pack 2
I'm currently under 'Vista' with service pack 1. There are great benefits to upgrading to 2 or 3?
-
My computer has been hijacked. A screen said I should buy this program VISTA 2011 to avoid future problems. I could not do anything on my computer so I bought it thinking it was from Microsoft VISTA. It wasn't. I downloaded the Microsoft software to