Copy link to clipboard
Copied
Hello Community,
can someone please tell me, if there´s a Script to convert a Layer of Text to Outlines?
I need it for wrapping text around a diagram, made with FF Chartwell
For me, it´s also necessary to open release the compound paths and activate text-wrapping to automate it for several documents. So one script that would do the trick will be appreciated.
If someone can point me to the right direction, it would be great!
Greetings
Markus
I found the solution!
...tell application "Adobe InDesign CC 2015"
tell active document
tell layer "diagramm_balken_auto"
repeat with x from (count every text frame) to 1 by -1
tell text frame x
try
create outlines with delete original
end try
end tell
end repeat
end tell
tell layer "diagramm_balken_auto"
repeat with x fr
Copy link to clipboard
Copied
Export it as PDF, in Acrobat Pro in Print Production > Preflieght convert it to Outlines. Never do such a thing in InDesign.
Copy link to clipboard
Copied
It MUST be done in InDesign, as I need to wrap text around the bars.
I know about exporting vectorized PDFs on-the-fly and converting-stuff in illustrator, acrobat and photoshop.
But in this case I need single-objects in InDesign.
Thanks!
Markus
Copy link to clipboard
Copied
Select the text frames and go to Type>Create Outlines
What is it you're doing exactly? What does "wrap around the bars" mean?
Copy link to clipboard
Copied
The OP is using the Chartwell font to make graphs...
Copy link to clipboard
Copied
Here´s a Screenshot for better understanding.
The Numbers must float above the bars. I´ve tried to reach this with creating a pdf, tiff, eps – with and without masks, alpha-channels, etc. Also the clipping path doesn´t work propperly. The only way to have the numbers directly near the bars ist the way to convert the bars (made out of the type chartwell) into outlines.
This, I have to do 800 times! So I need a script to do it. I´m just learning apple script now to reach that goal on my own.
Here´s my actual not working example:
--TextLayerOutline.applescript
--An InDesign AppleScript
--
--converts a layer of text to outlines, opens release compound paths and activates text-wrapping.
--
--For more on InDesign/InCopy scripting see the documentation included in the Scripting SDK
--available at http://www.adobe.com/devnet/indesign/sdk.html
--or visit the InDesign Scripting User to User forum at http://www.adobeforums.com.
--
tell application "Adobe InDesign CC 2015"
tell active document
tell active layer
tell every text frame
create outlines
release compound path
bounding box text wrap
end tell
end tell
end tell
end tell
Geetz,
Markus
Copy link to clipboard
Copied
There's a script here that does it on the current page
http://indesignsecrets.com/convert-to-outlines-and-remove-the-original-indesign-me-version.php
Another here https://sites.google.com/a/lapay.biz/www/convertalltexttooutlines
Apple Script way here http://macgrunt.com/tag/create-outlines/
In fact - a google search brings up all these https://www.google.com/search?q=indesign+convert+text+to+outline&ie=utf-8&oe=utf-8#safe=off&q=indesi...
Copy link to clipboard
Copied
Thanks Eugene,
I´ve found these scripts too and also have searched for several days to make the complete automation work. the macgrunt-tutorial is the one I´m actual learning the stuff and hope to get the last three steps finalized soon.
Copy link to clipboard
Copied
Hi Markus,
I think this is better discussed in the Adobe InDesign Scripting Forum here:
For a start I would say, let the editable chart be editable. There is an argument in create outlines you can set to false so a duplicate of the outlined text will be positioned above the editable text.
I'm no Apple Script guy, so I can only show you some code in ExtendScript (JavaScript).
Starting with a selection of the text (not necessary, only used for showing you the feature) you could run a jsx script line of code like this:
//Select some text:
var myText = app.selection[0];
var myArrayOfOutlines = myText.createOutlines(false); //false will leave the original text alone
Now we need a text wrap around the converted text and we need the fill color set to "None", otherwise the converted outlines will obscure the editable texts. This could be a bit tricky, because the outlines could be nested in groups or compound paths. I don't have Chartwell at hand to actually test all this.
So I did my tests on text based on Zapf Dingbats with the height of a HEAVY VERTICAL BAR set to different values.
I am still struggling with defining the distance, the textWrapOffset. Everything else is running as expected.
(A few minutes later:) Solved this now.
Let's start anew with the selected text frame holding the chart.
Before running the script I selected the text frame:
Now the situation after running the script on the selected text frame:
Here the code in ExtendScript:
//SetTextWrap-on-OutlinedText-SELECTED-TEXTFRAME.jsx
//Uwe Laubender
/**
* @@@BUILDINFO@@@ SetTextWrap-on-OutlinedText-SELECTED-TEXTFRAME.jsx !Version! Tue Jul 14 2015 11:25:07 GMT+0200
*/
//Text frame selected.
//Text wrap offset defined here:
var myTextWrapOffset = "2 mm";
//Set the text frame preferences to ignore text wrap first:
app.selection[0].textFramePreferences.ignoreWrap = true;
//Now we need the text to convert it to outlines:
//I suppose ALL text in the selected text frame should be converted:
var myText = app.selection[0].texts[0];
//Using method createOutlines()
//Argument false will create a duplicate outlined on top of the original text:
var myOutlinesAddedArray = myText.createOutlines(false);
//I suppose one group is made by createOutlines() stored in an array.
//**WARNING** With font Chartwell this could be different!
//So we have group object:
var myGroup = myOutlinesAddedArray[0];
//All objects inside the group could be addressed like that:
var myGroupedElements = myGroup.allPageItems;
//Then we need to iterate through all the elements of the group:
for(var n=0;n<myGroupedElements.length;n++){
//The individual element:
var myElement = myGroupedElements
.getElements()[0]; var myGeoBounds = myElement.geometricBounds;
//I will recommend:
myElement.fillColor = "None";
myElement.strokeColor = "None";
//Then we need the text wrap around each element:
//Setting the text wrap preferences
myElement.textWrapPreferences.properties = {
contourOptions : {contourType : ContourOptionsTypes.BOUNDING_BOX},
textWrapMode : TextWrapModes.CONTOUR,
textWrapSide : TextWrapSideOptions.LARGEST_AREA,
applyToMasterPageOnly : false
};
//This property should be set for itself, otherwise it is not working:
myElement.textWrapPreferences.textWrapOffset = [myTextWrapOffset,0,0,0];
};
As I already said, I have no idea, if this will work on text created by Chartwell.
The next step will be to identify all texts with Chartwell on a specific layer and run a script like that on all instances found in the document.
Btw. I have no idea how your chart values are created. Extra text frame per bar? Extra text frame per chart? Other means?
Uwe
Copy link to clipboard
Copied
Hi Uwe!
Thanks for helping me out!
First of all, the outlining of the current activated Textframe works.
Making Diagrams with Chartwell is very easy: You only have to type plain numbers like this: 22+88+1+37+2+12+3+21+25+1+14
For my Charts I had to combine two years (red and blue bars). For that I had to create two separate textframes next to each other. And for negative values, you don´t see in my example, two more mirrored over the x-axis. So I have 4 Textrames for every chart on a page. 800 more pages to come. The bars are on a separate layer, named: diagramm_balken_auto
Your script has outlined one frame to a compound path and now needs to be released, otherwise the texts won´t stick at the bars.
Greetz
Markus
Copy link to clipboard
Copied
How do I move the discussion to the scripting forum? Or do I have to create a second one?
Copy link to clipboard
Copied
I've moved it for you...
Copy link to clipboard
Copied
thanx!
Copy link to clipboard
Copied
Javascript is to complicated for me, but I tried to reach the same solution with Applescript.
To outline every textframe on my specific layer: diagramm_balken_auto I´ve done this:
tell application "Adobe InDesign CC 2015"
tell active document
tell layer "diagramm_balken_auto"
repeat with x from (count every text frame) to 1 by -1
tell text frame x
try
create outlines with delete original
end try
end tell
end repeat
end tell
end tell
end tell
when I want to release the compound path and activate bounding box text wrapping I tried this, what doesn´t worked:
tell application "Adobe InDesign CC 2015"
tell active document
tell layer "diagramm_balken_auto"
repeat with x from (count every text frame) to 1 by -1
tell text frame x
try
create outlines with delete original
release compound path
bounding box text wrap
end try
end tell
end repeat
end tell
end tell
end tell
Can someone please help me out on that?
Greetz
Markus
Copy link to clipboard
Copied
Ok, the release of the compound path works also. Only the text wrapping needs to be done.
tell application "Adobe InDesign CC 2015"
tell active document
tell layer "diagramm_balken_auto"
repeat with x from (count every text frame) to 1 by -1
tell text frame x
try
create outlines with delete original
end try
end tell
end repeat
end tell
tell layer "diagramm_balken_auto"
repeat with x from (count every polygon) to 1 by -1
tell polygon x
try
release compound path
end try
end tell
end repeat
end tell
tell layer "diagramm_balken_auto"
repeat with x from (count every item) to 1 by -1
tell item x
try
set text wrap mode of text wrap preferences of item to bounding box text wrap
end try
end tell
end repeat
end tell
end tell
end tell
Copy link to clipboard
Copied
Sorry guys,
i´m still lost. I´ve tried to apply an object style (with text wrapping attributes) now, but it gives me an error message, my object style "umfliessen" couldn´t be read. Maybe I have to refer it at a different position (not at line 22)?
tell application "Adobe InDesign CC 2015"
tell active document
tell layer "diagramm_balken_auto"
repeat with x from (count every text frame) to 1 by -1
tell text frame x
try
create outlines with delete original
end try
end tell
end repeat
end tell
tell layer "diagramm_balken_auto"
repeat with x from (count every polygon) to 1 by -1
tell polygon x
try
release compound path
end try
end tell
end repeat
end tell
tell layer "diagramm_balken_auto"
set objStyle to object style "umfliessen"
repeat with x from (count every item) to 1 by -1
tell item x
try
apply object style using objStyle
end try
end tell
end repeat
end tell
end tell
end tell
Also found the correct way of posting code. Sorry for the past entries!
I´m still hoping to get it done with some help of yours.
Thanks,
Markus
Copy link to clipboard
Copied
I found the solution!
tell application "Adobe InDesign CC 2015"
tell active document
tell layer "diagramm_balken_auto"
repeat with x from (count every text frame) to 1 by -1
tell text frame x
try
create outlines with delete original
end try
end tell
end repeat
end tell
tell layer "diagramm_balken_auto"
repeat with x from (count every polygon) to 1 by -1
tell polygon x
try
release compound path
end try
end tell
end repeat
end tell
tell layer "diagramm_balken_auto"
repeat with y from (count every spline item) to 1 by -1
tell spline item y
set text wrap mode of text wrap preferences to bounding box text wrap
end tell
end repeat
end tell
end tell
end tell