[JS] [CS3] Change the type of content in a block of text

Hello

an hour, maybe a little basic but I'm stuck on this...

I need a textFrame to become a graphical object.

The textFrame has no content.

How can I change the contentType for this item?

Thanks anticipately.

It sounded like an interesting challenge, so I take a shot at him. I have created a new document and adds three blocks of text (uninhabited) on the first page. I have them the tag 'Image', 'legend' and 'credit' I've then exported as an extract, deleted the document and has opened a new. Then I placed the excerpt (so far, all manual summer - no script) and indeed, the snippet placed and executives have been added to the structure of the document and have been correctly labelled - the three tags were created automatically by the Act of placing the code snippet.

So, we will duplicate this in a script. Even though I know exactly where the extract is, I'll ask the user to find. In this way, I eliminate the problem to get the path to the incorrect code snippet:

var myDoc = app.documents.add();
var myPage = myDoc.pages[0];
var myPlacePoint = [myPage.marginPreferences.left, myPage.marginPreferences.top];
var mySnippetFile = File.openDialog("Choose the snippet");
if (mySnippetFile == null) { exit() }
var mySnippet = myPage.place(mySnippetFile, myPlacePoint);

And it worked. The excerpt is on the page, exactly where I wanted. So now we have to find the block of text with the tag 'image '. First of all, we need to study just is that mySnippet.

OK, this is a picture of three stories. It's a little weird. Why isn't there a table of three blocks of text? I wonder what happens if two executives in the extract are threaded - but we'll deal with it later, after we would solve the immediate problem. The fact is that we know that the code snippet consists of three separate text blocks that are not threaded. So:

for (var j = mySnippet.length - 1; j >= 0; j--) {
     var myTag = mySnippet[j].associatedXMLElement.markupTag.name;
     alert(myTag);
}

What gives me the three tags (and reminds us that when you tag a text block, you are also marking the history it holds. So:

var myDoc = app.documents.add();
var myPage = myDoc.pages[0];
var myPlacePoint = [myPage.marginPreferences.left, myPage.marginPreferences.top];
var mySnippetFile = File.openDialog("Choose the snippet");
if (mySnippetFile == null) { exit() }
var mySnippet = myPage.place(mySnippetFile, myPlacePoint);
for (var j = mySnippet.length - 1; j >= 0; j--) {
     var myTag = mySnippet[j].associatedXMLElement.markupTag.name;
     if (myTag === "Image") {
          var myFrame = mySnippet[j].textContainers[0];
          myFrame.contentType = ContentType.graphicType;
          break;
     }
}

And who does the work.

Thomas,

You were very close, but you forgot that text blocks that make up a story are addressed as textContainers of CS3 from. Your code worked in CS2.

Dave

Tags: InDesign

Similar Questions

  • To change the type of search to a string field in the DataObject Layout

    Hi all

    I am trying to change a simple string search field type, but at the same time, I don't want to lose the contents of the field. Is it possible to BAM?

    Thank you

    Jayanthi

    Hi Anne,.

    When we have data in place, that we cannot change data - type.you can do you something like make a backup of the data using Icommand object.

    and change the type of xml data exported in importing data Object.and the same.

    It's like ricks, if the purpose of these data are interrelated with other data object or if you created reports on the same.

    try something like that when you finished taking backup of all things

    Concerning

    Shankar

  • Change the Type of definition email - error

    Hello Experts,

    When I try to change the type of "Général" email template "Asked related" it throws error "Email change Type is currently not supported".

    Is this behavior? Can not change us the e-mail type once it is?

    Also what is the level of e-mail data?

    Thanks and greetings
    INIYA

    You can modify the same database only. But if you then change you have to change the content as well, if you send in your email.

    Yes it is not taken in charge because for each type, it shows different things.

    You can delete the old and create a new one with the new type. There is not a lot of time. You

  • Qosmio F10 - cannot change the type of HARD drive in the BIOS

    I want to change my hard drive, but the category in the BIOS is not editable.

    I can not change the type of hard drive in the BIOS on my desktop PC.

    Hello

    And you want to change in the BIOS now?
    I put t know which option you mean exactly

    The drive in the BIOS, you can change t. That's why you should buy a new

  • Change the type of sensor pressure strain for SCXI-1314

    Hello!

    I would like to ask how to change the type of strain sensor.

    I use SCXI-1314 and one of my pressure sensor is a type of 4-wire. (Output 100mV, excitement: 10vdc)

    , but I want to replace the sensor by another type of current output type. (Output 4 ~ 20mV, excitement: 12-30Vdc)

    I checked the output voltage cable 4. (Defined as full-bridge OR max)

    Power + = Ex +.

    Food - = Ex-

    CH+        =  S+

    CH-         =  S-

    However, I don't know how to connect the type 2-wire with SCXI-1314.

    In addition, I don't have enough experience on the types of bridge (bridges and whole, quarter half)

    Can you explain what I need to do?

    One thing you migth try is to put a 5 Ohm resistor in the current loop. causing a drop in voltage 100mV on resistance, however check the soil conditions.  Since you will need a new calculation of sensitivty sensor anyway you can use a resistor 4.7 Ohm or 2 10 ohms in parallel... just find a good match between your 1314 input voltage range and the 4-20mA.

    And you will have an external power supply for the sensor.

  • Can you change the type of device to 'USB Raw resource' to GPIB controller?

    I'm trying to configure a GPIB FL Contec GP - IB (USB) controller in MAX.  I could so he can register through the creation of a pilot of the Assistant driver VISA, but it fits as a "gross resource USB" rather than as a GPIB controller.  I can send and receive information from the controller, but it does give me an option to search for connected devices of GPIB communicate with them.  Is it possible to change the type of the device, maybe by manually changing the driver created by the wizard of the NI-VISA driver?  Thank you for your time.

    N ° do not use MAX at all. You can just create a GPIB-USB controller on your own. You should contact the seller.

  • Change the type of serial number of UUT

    Hello

    I am a new user of Teststand and I would like to change the type of serial number to USE.

    or add condition number of the operator to write in the information of the object to measure dialog box.

    I want the serial number that have just number 20 and no letters.

    If the serial number is different, the dialog box should reappear as at the beginning.

    Hope that I was clear.

    Thank you

    You will need to replace the PreUUT callback and then build some sort of algorithm to verify the serial number desired.

    I've attached an example of how do.

  • Update of cases in the structure of the case after having changed the 'Type of case.

    Hello

    After you change the "Type of business" (only one case has been deleted), I discovered that in cases of strcuture cases has become "damaged": case "named" have been changed to digital small (that is, 0, 1, 2, 3).

    Is there a way to den strcuture case?

    Thank you

    Pavel

    Right click on one of the enums greyed out and choose 'review and update of Type Def.  That should allow you to solve problems.

  • How to change the type of insurance policy indicator on front panel

    Hello

    I want to change the type of digital indicator police led style. I have the police. But, how can I change the type of indicator of independent policy and not only not by changing the type of policy application. I checked the property node available are only color, size, justification, but type.

    Yoppy.

    Go

     

    LED > right mouse click > Create > property Node > Label > police > name

     

    then use (or)

     

    Digital > right mouse click > Create > property Node > digital text > police > name

    Kind regards.

     

  • Change the Type of Interpolation of waveform graphic part

    Hello dear colleagues,

    How can I change the type of interpolation to a graph of waveform in part? Check the attached photo.

    I don't want yellow interpolation to the beginning of the measure.

    I know that the interpolation can be modified with the property node, but this has an influence on all points.

    Any idea?

    Thank you very much.

    Hi maximint,

    -NaN values used to hide unwanted in the plot points

    -use separate plots when you do not want the "edges" in land line

  • How can I change the type of chassis in an existing CompactRIO project?

    Hello

    I have a built in LabView 8.2 for a chassis 9101 cRIO. Now, I want to bring to LabView 2009 and use it on a chassis of 9104. I would have thought this should be simple, but there is a VI on the FPGA itself. When you compile, I get the error "the device type that has been set up in this function does not match the actual type of the device. I don't want to have to remove the frame of the project & add it back (losing all the settings it can have) - is there a way just to change the type of target, but keeping the relevant parameters?

    Thanks for any help!

    Dave

    Hi Dave,.

    Once you've practiced it several times it is actually a piece of cake.

    Right click on the project select new target or device

    Rember just to specify rather than the current goal.

    Otherwise, you will have a conflict.

    The new target is initialized to the Ip (0,0,0,0) then re address assignment standard.

    Copy (drag) all the components for the new device (RT & FPGA if included)

    Note it's manual labor rather than you have to 'say' labview what material he must understand!

    concerning

    Xseadog

  • Is possible to change the type of node WINS with cmd command on a windows operating system that is not joined to the domain?

    Is possible to change the type of node WINS with cmd command on a windows operating system that is not joined to the domain?

    Hello

    The question you posted would be better suited to the TechNet community. Please visit the link below to find a community that will provide the support you want.

     
     

    Hope this information is useful.

  • Change the type of user account is not updated

    I changed my account type standard user principal and account invited to administrative yesterday. Now, I want to change it back but is not allow me to change my primary administrative standard. I can click on it, but it is not updated. What should I do to not having guest account my administrative account?

    Hello

    You receive an error message or code everything by trying to change the type of account?

    Note: Guest account cannot be defined as administrative account. There the option only to turn on or off.

    Reference: Change the type of user account

    http://Windows.Microsoft.com/en-us/Windows-Vista/change-a-users-account-type

    If there is an another account on your computer, and then log on to the administrative account and then try to change the account type.

    Method 1: Activate the default Administrator account, and then try to change the type of account and check if it helps:

    Enable and disable the built-in Administrator account

    http://TechNet.Microsoft.com/en-us/library/dd744293 (WS.10) .aspx

    Method 2: If the above mentioned method does not work then try the system restore:
    http://Windows.Microsoft.com/en-us/Windows-Vista/what-is-system-restore

  • How to change the type of user account in the registry editor

    Hello.

    Can someone tell me how to change the type of user account in the registry editor

    Thanks in advance... :-)

    Kind regards
    Rambeau

    Hello.

    Can someone tell me how to change the type of user account in the registry editor

    Thanks in advance... :-)

    Kind regards
    Rambeau

    You can not. You need to do this via the control panel / accounts of users or via the command prompt. In both cases, you need to be logged in as an administrator account.

  • in windows 7 I can't find a way to change the type of photo paper glossy

    in windows 7 I can't find a way to change the type of glossy photo example

    I have an epson r1800 and a 595 epson all in one help please

    I use photoshop elements 10

    original title: impression of the printer

    Perhaps the following links will propose a few ideas:

    Windows 7 - choice of print options
    http://Windows.Microsoft.com/en-us/Windows7/choosing-print-options

    Windows 7 - print a photo
    http://Windows.Microsoft.com/en-us/Windows7/print-a-picture

Maybe you are looking for