take the text to the center of the object

Hello everyone.

I have a task to create the text in the center of any object.

For example I have simple object

Screenshot_2.png

After using my script, we can see effect like that

Screenshot_6.png

I use new areaText for her creation.

BUT I can't use areaText if we have a hole inside the object.

Screenshot_3.png

because illustrator think its two different object and the text to take into the hole (2 times: for the buoy red and white circle),

So I need to keep red donut text...

Screenshot_7.png

How can I do?

Hi chudomozg,

your 'donut' is a compound path (with 2 pathItems).

Maybe it's a bit more useful for you:

// CompoundPath_WidthOfElements.jsx
// required: open document with one selected compound path e.g. a "donut"

var aDoc = app.activeDocument;

var sel = aDoc.selection;
if (sel[0].typename == 'CompoundPathItem') {
    alert(sel[0].pathItems.length);
    alert(sel[0].pathItems[0].visibleBounds[2] - sel[0].pathItems[0].visibleBounds[0]); // width in Points
    alert(sel[0].pathItems[1].visibleBounds[2] - sel[0].pathItems[1].visibleBounds[0]);
    }

Have fun

Tags: Illustrator

Similar Questions

  • Can I take the option do not disturb on my control center?

    I can take the option do not disturb on my control center so it does not show when I slide up?

    N °

  • I activated the auto updates. When I take the update it says in the center of the page "the page failed to load".

    I activated the auto updates. When I take the update it says in the center of the page "the page failed to load".

    I tried to take different paths, as via the Control Panel, but it's the same thing.

    Operating system?

    Try the following: -.

    Open search Vista Start Menu Bar and type: RUN

    Click OK

    Type the following lines, and after each one, click OK: -.

    regsvr32 jscript

    regsvr32 vbscript

    regsvr32 /i mshtml

    No guarantee

    TaurArian [MVP] 2005-2010 - Update Services

  • Center text to the left of the object

    How to align the center of the text to the left of the object? Make the object the object 'key '? I want the object remain in place.

    Use smart guides.

  • 2014 CC Dreamweaver takes conditional text? Specifically, I can put all my tech in a location data and the output of the subsets of data (doc Admin against doc user versus doc Marketing) based on tags or other methods?

    CC of Dreamweaver takes conditional text? Specifically, can I put all of my tech data in a doc of DW and the output of the subsets of data (doc Admin against doc user versus doc Marketing) based on tags or other methods?

    I don't have any front-end text editor (such as FrameMaker) or I'd do it here. Dreamweaver can do this without complex workarounds or procedures not supported?

    Thank you very much.

    Mike the Newbie

    OK, that's fine. DW not conditionalization and I'll see if I can get what I need to do or find another approach.

    Thanks a lot for your help.

    Michael

  • Hit the tab key changes the withdrawal. How can I do tab take the cursor to the next tab stop?

    Currently in the latest version of Pages, the tab key changes the line indent. How can I take the cursor to the next tab stop? The document was created in Word format. I work with Yosemite 10.10.5 on a MacBook Pro with 8G of RAM and hard disk of 1 t.

    The removal of default tab in v5.6.2 Pages is 0.5. You have formally the additional tab stops in Text Format: Panel layout, or with your ruler displayed or clicked on it to set the tab indents?

    Pages is not a clone of the word and the Act to translate automatically the Word document to the internal .pages format when opened by Pages - may or may not honor prior model and Word document settings.

  • JavaScript input parameter should take the value of the element page Apex

    I have a JavaScript function which i dwonloaded ffrom net to generate bar codes

    DrawCode39Barcode(data,checkDigit).

    I call this function in the body of page attribute by using the following script

    < div id = "P5_X" > < / div >

    < script type = "text/javascript" >

    / * < ! [CDATA [* /]]

    function get_object (id) {}

    var object = null;

    If (document.layers) {}

    object = document.layers [id];

    } Else if (document.all) {}

    object = document.all [id];

    } else if (document.getElementById) {}

    object = document.getElementById (id);

    }

    Returns the object;

    }

    get_object('P5_X').innerHTML = DrawCode39Barcode('1-1-1111',0);

    < /script >

    When I run the page, the barcode for the value 1-1-1111' is generated. Please help so that when this page is running it will automatically take the value of the page item P5_X as parameter instead of hard coded value ' 1 - 1-1111'

    I think it would be simpler. You use the same id for the region and the order of the day, they must be different id

    JavaScript code can be in a dynamic action who sets fire to the loading of the page, or load Execute on the page of your page properties section.

    $('#barcode').html (DrawCode39Barcode ($v ('P5_X'), 0));

  • Center align several objects (as of the tic tac toe)

    Hi all

    In CC I want to center align several objects in a grid that can be 3 x 3 as morpion =

    tictactoe.png

    or 4 x 10 or other. Use a grid for this? If if I defined a grid in Edition / Preferences / Guides and grid, but now I can not see how to center align an object to a square of the grid. Any ideas please?

    Thank you...

    There are many tools to do this in Illustrator. Better to keep your questions simple, precise and at the same task, do not know if you ask how to create the whole image shown or how to align 1 column x and O

    Use the align palette window and which is activated using guides on slam. Take a look at the key of objects, which are very useful.

    How to move, align and distribute objects in Illustrator

  • Release of anchor all the objects/text images

    Dear all,

    It's my 1st question on AC (Adobe Community), so I'll explain what I need here in details and excuse me my little or even none experienced in coding, especially in Javascript.

    I have a book with many INDD files, these files have a lot of images and objects and text blocks are anchored to the main text area.

    I searched on AC for the way to free him from all my anchored object and the main text block text block. so I found the average script.

    I found her name "ReleaseAnyAnchor" created by 'Dave Saunders' to release the anchored object (graphics, text, else) but one by one. and it will take too much time to free myself from all the objects on the book. (the Script code is below)

    //DESCRIPTION: Release Inline & Anchored Items
    //Written by Dave Saunders, released on indesignsecrets.com
    
    
    (function() {
      if (app.documents.length > 0 && // must be a document open
      app.selection.length == 1 && // selection must be of single item
      app.selection[0].parent instanceof Character) { // selection must be anchored
      if (parseFloat(app.version) < 6) {
      releaseMe(app.selection[0]);
      } else {
      app.doScript(releaseMe, undefined, app.selection[0], UndoModes.entireScript, "Release Any Anchor");
      }
      } else {
      alert("Please select an inline item.");
      }
    
    
      function releaseMe(myPI) {
      var yePage = findPage(myPI);
      var startBounds = myPI.geometricBounds;
      myPI.anchoredObjectSettings.anchoredPosition = AnchorPosition.anchored;
      myPI.anchoredObjectSettings.releaseAnchoredObject();
      if (yePage != null) {
      myPI.move(yePage);
      }
      myPI.move([startBounds[1], startBounds[0]]);
      }
    
    
      function findPage(theObj) {
      if (theObj.hasOwnProperty("baseline")) {
      theObj = theObj.parentTextFrames[0];
      }
      while (theObj != null) {
      if (theObj.hasOwnProperty("parentPage")) return theObj.parentPage;
      var whatIsIt = theObj.constructor;
      switch (whatIsIt) {
      case Page : return theObj;
      case Character : theObj = theObj.parentTextFrames[0]; break;
      case Cell : theObj = theObj.insertionPoints[0].parentTextFrames[0]; break;
      case Note : ; case Footnote : theObj = theObj.storyOffset; break;
      case Application : return null;
      }
      if (theObj == null) return null;
      theObj = theObj.parent;
      }
      return theObj
      } // end findPage
    
    
    }());
    


    also, I found another script which release all of the graphic objects, but not objects of text frame. (I get it from AC, but I remember exactly the place where.)


    if(app.documents.length!=0) {
        var ad = app.activeDocument;
        var pgit = ad.pageItems;
        var pgitlg = pgit.length;
        var objprocessed = 0;
        if(pgitlg !=0)
        {
            for(i=0; i<pgitlg; i++)
            {
                if(pgit[i].getElements()[0].constructor.name == "TextFrame")
                {
                    var tfg = pgit[i].allGraphics;
                    var tfglg = tfg.length;
                    for(j=0; j<tfglg; j++)
                    {
                        var rec = tfg[j].parent;
                        rec.anchoredObjectSettings.releaseAnchoredObject();
                    }
                }
            }
        }
    }
    


    all codes work well for me, but I need to try to merge or make a new code [as I mentioned that I don't have experiences in JS, so I do not know how to compile a new code that do the 2 steps of the 2 codes.]


    my request is, could you please help me to do this new code, or merge to compile a new code in the new file.


    I saw this topic releasing objects anchored and want to make a new script.


    Please try to help me as soon as POSSIBLE because I need this script to all my object anchored to begin working on the output file.


    I need the code works on any version of INDESIGN.


    Thanks guys, waiting for you.


    AMR

    AHA. If you need test whether a line is an anchor. If this is the case, use. releaseAnchoredObject(), if it is not, the simplest is to make an anchor, then release it:

    if (pageItems[i].parent instanceof Character) {
        if (pageItems[i].anchoredObjectSettings.anchoredPosition !== AnchorPosition.ANCHORED) {
            pageItems[i].anchoredObjectSettings.anchoredPosition = AnchorPosition.ANCHORED;
        }
        pageItems[i].anchoredObjectSettings.releaseAnchoredObject();
    }
    

    It works, but I don't know if the results are what you're after.

    Peter

  • How to get the default rotation tool locate the pivot point in the exact Center of an object or a group of objects?

    My new copy of the CC the default pivot set to one side, rather than at the center point. I know I can manually move the autour pivot point, but this is not always accurate. Is there a way to have HAVE determine exactly at the Center and then do this by default?

    Pivot the tool rotation default to the center of objects and the text box (frame). For text of Point, it is by default the anchor of the line base, and for a group of Point text objects, or multi-selction defaults to the geometric center of an invisible shape formed by the collective reference anchors.

    And you are right, that the setting of Center in the attributes Panel is not available for text of Point, single or multiple objects.

    I don't have an idea for your particular workflow needs, but if I really need to turn a group of objects text around its Center Point, I could do this:

    1. Select the group, and copy
    2. Paste in front
    3. Vectorize
    4. Select the converted objects and text objects group, then select the rotation tool and the pivot will be by default the Center (of the converted objects)
    5. After turning, remove the converted objects.
  • I bought the iphone 6 to find her icloud is locked. I tried to contact the owner, but I can't reach him. are there opportunities to take the step of activation? Thank you.

    I bought the iphone 6 to find her icloud is locked. I tried to contact the owner, but I can't reach him. are there opportunities to take the step of activation? Thank you.

    Hello

    You describe Activation Lock, which prevents the unauthorized use of the iPhone if it is lost or stolen.

    This can be disabled either by:

    • The former owner, grabbing their Apple ID and password of the device.
    • The previous owner, removing the iPhone in their list of devices to locate my iPhone via iCloud.com.

    In both cases, be sure to follow the instructions in the first article below.

    If you can not organize or either of these actions, then you will not be able to use the iPhone. There is no way around this security feature.

    More information and instructions:

    Turn off find my iPhone Activation Lock - Apple Support

    Find my iPhone Activation Lock - Apple Support

  • The text of the e-mail under the column of the object does not match the selection

    When I get to my Inbox and select an e-mail to open the middle box and the text box below do not match the selection in the object column. This has occurred recently and only on my laptop. My office works fine. The central area and the text matching, this email has been deleted but the text won't just change and go. I'm going on a trip tomorrow, and if I can't fix this, I won't be able to open emails with possible solutions. I'll see answers but can't open them.

    right click on the folder, select Properties, and then on the button repair.

  • As a person in the main video takes the floor, I want to insert an image, while the audio stays...

    I have one main video where a woman takes the floor. In his speech, I would like to continue talking while using different images that makes her disappear, but not the audio... How do I with IMovie on my IPhone?

    See iMovie for iOS (iPhone, iPod touch): organize audio clips. You should be able to detach the original clip audio but keep them lined up, allowing you to adjust the video and then move on to still images while the audio continues to play.

    TT2

  • My PC crashed. Restored on a new record and a new installation of FireFox. I can still access all the files. How do I take the old bookmarks if there is no backup?

    My PC crashed. Restored on a new record and a new installation of FireFox. I can still access all the files on the old drive. How do I take the old bookmarks if no backup exists, or has been completed? Does not save bookmarks of FireFox auto? If, then what is the file name and where is normally stored by FireFox?

    In fact, it can be easier...

    If you have the old drive connected as, say, drive E, go to:

    E:\Users\username
    

    Then click in the address bar and paste it after this and press ENTER to open it:

    \AppData\Roaming\Mozilla\Firefox\Profiles
    

    Normally, you have only one file, which has a random string followed by "default." In this case, click on this file and find the subfolder bookmarkbackups.

    If you find multiple profile folders, look inside to find the most recently updated backups.

    To restore the backup files, see: restore bookmarks from a backup or move them to another computer

  • I exported the photos in a folder that is named in the order. Now I want to export more photos in the same folder, but take the sequential numbers where the last export was stopped. Finally was Apr_409, in following should be Apr_410. Not Apr_1 (1). Any a

    I exported the photos in a folder with the photos sequentially named. Now I want to export more photos in the same folder, but take the sequential numbers where the last export was stopped. So if the last photo was named Apr_409, I want the following to be Apr_410. Not Apr_1 (1). Any advice? Thank you!

    Hat is not a feature of Photos.

    If you want to make sure your new export is sorted after previous export, change the field "sequential prefix" in the Panel of the export to a string, which will be sorted after the original prefix you have chosen.

Maybe you are looking for

  • want to open a mail when you click

    Years if I clicked on an email it would open in a new tab. Now, he goes to the new tab but does not open unless I click on the new tab. How to bring back this feature?

  • Satellite L350-277 - Webcam do not initialize

    I still have a problem with my webcam on the laptop above. It worked when I bought the laptop, but for some reason any, it is now a failure to initialize.I have posted before and advises him to download the drivers.I did, but it still doesn't work.An

  • I'm a quadriplegic tries to use Siri... A lot of problems

    as a quadriplegic, I try to use Siri, but there are too many orders which must go hand in hand with physical contact of the phone. I can't do it. There is no way I know to hang up the phone, the use of the tree of voices when you call a company, chan

  • Logon key Bluetooth does not recognize mobile phones during the installation procedure

    Hello My Portege M400 with bluetooth stack 4.00.25 (bought in July 2006) doesn't recognize any mobile phone during the implementation of how to connect key wireless - except once with a foreign mobile PHONE a few days ago. Mobile phones are also reco

  • Looking to order a replacement part

    One of my colleagues broke a part off their printers HP LaserJet multifunction 1536dnf and now it doesn't work at all. See below: This piece was broken in two, and it must be intact and attached to the printer to make it work. I know it of a long sho