A script for replacing texts only in selected layer?

Hi all,
I have an illustrator document which has many text layers. I have found the script below that replace a text with another one in the document;
var doc = app.activeDocument;
var myTextFrames = doc.textFrames;
for (i = 0; i < myTextFrames.length; i++) {
var myTF_ByI = myTextFrames[i];
var str = myTF_ByI.contents
var res = str.replace("word1", "word2");
myTF_ByI.contents = res
However, there is one problem that the script also replaces the text in other layers even though they are hidden or locked. Could you help me adjust this script to be effective only for the selected or unhidden layer?
Cheers,
Akin

Hi elmagnifico,
this is strange.
Before running the script snippet:
and after running the snippet:
Can you show us your layers palette? Do you really layers mean – and not sublayers or not simple text items in one layer???
regards

Similar Messages

  • SAP VB script for updating texts in purchase orders

    Hello,
    I am trying to create a SAP script for updating texts in purchase orders. It is in the last third - Item Detail,  Texts tab.
    The script is ok apart from the fact that it always deletes whatever text is in there and than add a new one.
    I would like to keep history in the texts tab and always just add one line to existing texts. Is there any way (command) how
    to keep existing texts and only add a new line to the top?
    Thanks a lot!
    Jan

    Yes, you are exactly right. I have already figured it out as well. I did not expect it would be that easy. But thanks a lot anyway for replying on this!
    Now I am struggeling with changing SAPLMEGUI in vb scripts for ME22n. Sometimes, there is SAPLMEGUI:0010 and sometimes SAPLMEGUI:0015. Even when the users have the same screens in the beginning the SAPLMEGUI number differs. They also do one item by hand and than it changes. It keeps changing between SAPLMEGUI:0010 and SAPLMEGUI:0015
    Is there a way how to have the same number of SAPLMEGUI or how to eliminate this issue?
    Thanks a lot
    Jan

  • I am in need of ai script for arcing text

    i am in need of ai script for arcing text

    A little vague aren't we… Is this the kind of arcing you mean? Text along a curve or do you mean distorting into an arch like some plug-in can?
    #target illustrator
    var doc = app.activeDocument;
    doc.defaultFilled = false, doc.defaultStroked = true;
    var textPath = doc.pathItems.ellipse( 0, 0, doc.width, doc.height );
    textPath.pathPoints[3].selected = PathPointSelection.ANCHORPOINT;
    app.cut();
    doc.selection = null;
    app.redraw();
    var tp = doc.textFrames.pathText( doc.pathItems[0], 0, 0, TextOrientation.HORIZONTAL );
    tp.textRange.paragraphAttributes.justification = Justification.CENTER;
    tp.textRange.characterAttributes.size = 60;
    tp.contents = 'I am in need of ai script…';
    var tpd = tp.duplicate();
    tpd.translate( 0, -150 );
    tpd.textRange.characterAttributes.size = 90;
    tpd.contents = '…for arcing text?';

  • Ola script for update stats only

    I want ola scripts for update stats only but on internet they are rebuilding index as well.
    http://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html
    Thanks

    By default index rebuild will gather index stats.
    If you just need a script update index and column statistics you can refer the below link
    http://www.sqlusa.com/bestpractices2005/administration/updatestatistics/
    You can refer same ola script to update the stats
    http://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html
    C. Update statistics on all user databases
    EXECUTE dbo.IndexOptimize
    @Databases = 'USER_DATABASES',
    @FragmentationLow = NULL,
    @FragmentationMedium = NULL,
    @FragmentationHigh = NULL,
    @UpdateStatistics = 'ALL'
    D. Update modified statistics on all user databases
    EXECUTE dbo.IndexOptimize
    @Databases = 'USER_DATABASES',
    @FragmentationLow = NULL,
    @FragmentationMedium = NULL,
    @FragmentationHigh = NULL,
    @UpdateStatistics = 'ALL',
    @OnlyModifiedStatistics = 'Y'
    --Prashanth

  • Looking for Scripts that Replaces Text and Master Pages

    I have just found the Script Library panel in FM 10. (Always used InDesign before.)
    I'm up to replace a text string and two master pages in 100+ documents. Tried to google for some nice solutions to make this automatically but cannot find any scripts/macros to FM at all.
    Do you have som tip where to find such script/macro?

    100 is a small enough number that no time may be saved writing a script (assuming none exist for the purpose).
    I'd be tempted to ...
    Create a sourcing file that has the new MPs needed (and safe versions of MPs "Left" and "Right")
    Create a new Book file.
    Add to it all 100 of the files needing update (this is the only tedious part).
    Use Find/Replace from the Book menu to fix the text string.
    Select all book component files:
    File > Import > Formats
    Import from Document [MPsourcefilename.fm]
    [Deselect All]
    [*] Page Layouts
    [Import]

  • Looking for Scripts that Replaces Text and Master Pages (Batch Missing Files and PDFs)

    I have just found the Script Library panel in FM 10. (Always used InDesign before.)
    I'm up to replace a text string and two master pages in 100+ documents. Tried to google for some nice solutions to make this automatically but cannot find any scripts/macros to FM at all.
    Do you have som tip where to find such scripts/macros?
    To facilitate my work I also look for a batch script that automatically updates the image pathes in each framemaker file (image folder has been renamed).
    And at a last FrameMaker -> PDF Batch converter.

    100 is a small enough number that no time may be saved writing a script (assuming none exist for the purpose).
    I'd be tempted to ...
    Create a sourcing file that has the new MPs needed (and safe versions of MPs "Left" and "Right")
    Create a new Book file.
    Add to it all 100 of the files needing update (this is the only tedious part).
    Use Find/Replace from the Book menu to fix the text string.
    Select all book component files:
    File > Import > Formats
    Import from Document [MPsourcefilename.fm]
    [Deselect All]
    [*] Page Layouts
    [Import]

  • Script for validating Text fields or numeric fields

    I'm looking for a simple script that will check the entered data in a specific field.If i enter numbers in the name/last name field i should get a pop up message that entering numbers in this field are not allowed.
    (And vice versa regarding numeric fields).
    What is the script for that ?

    Hi,
    try this:
    //var reg = /^\d+$/;    // checks whether input contains ONLY digits
    var reg = /\d+/;    // checks whether input contains digits AND letters
    var check = reg.exec(xfa.resolveNode("#subform[0].#field[0]").rawValue);
    if (check == null)
        app.alert("Everything's fine!");
    else
        app.alert("Entering digits is not allowed!");
    You may want to replace
    #subform[0] with the name of the subform the field to check is located in and
    #field[0] with the name of the field to check for digits.
    Also, you may want to select any of the regular expressions, which fits best your needs. See comment in the above code-fragement for further information.
    Regards,
    Steve

  • Script for replacing Image from a frame into InDesign document file

    Hi All,
    I am having an indesign document (indd) file with images and texts. I am using InDesign Server CS4 to run the scripts via SOAP.
    My requirement is to replace any of the images from the required frame/s of indesign document through scripting (I already have frame id of which image needs to be replaced). I have written written java-script file (as given below): but when I execute this java-script on InDesign Server via SOAP, I get follwoing error into InDesign Server:
    10/03/09 15:15:54 INFO  [javascript] Executing File: \\Server_IP_Address\JavaScript_File_Path\JavaScript_File.js
    10/03/09 15:16:01 ERROR [link manager] Link missing.; file:C:/help.gif
    10/03/09 15:16:01 ERROR [link manager] Link missing.; file:C:/Documents%20and%20Settings/All%20Users/Documents/My%20Pictures/Sample%20Pictures/ Water%20lilies.jpg
    10/03/09 15:16:01 ERROR [link manager] Link missing.; file:C:/Documents%20and%20Settings/All%20Users/Documents/My%20Pictures/Sample%20Pictures/ Winter.jpg
    Following is the java-script that is being used for replacing image from indd's frame:
    var myDocument = app.open(File('//Server_IP_Address/InDesignDocument_File_Path/Sample.indd'));
    var tmp_frmid="1339"; //frame id of which image needs to be replaced.
    for (var i=0;i<myDocument.pages.length;i++)
    var objPage=myDocument.pages.item(i);
    var objPageitems = objPage.pageItems;
    try
    var obj = objPageitems.itemByID(tmp_frmid);
    obj.images[0].remove;
    obj.appliedObjectStyle = null;
    var myImage=obj.place(File('//Server_IP_Address/Images_to_be_reolaced_Path/ImageFile.jpg'));
    var old_height = myImage.geometricBounds[2] - myImage.geometricBounds[0];
    var new_height = obj.geometricBounds[2] - obj.geometricBounds[0];
    var old_width = myImage.geometricBounds[3] - myImage.geometricBounds[1];
    var new_width = obj.geometricBounds[1] + ((new_height / old_height) * old_width);
    myImage.geometricBounds = [obj.geometricBounds[0] + "mm", obj.geometricBounds[1] + "mm", obj.geometricBounds[2] + "mm", new_width + "mm"];
    var diff = obj.geometricBounds[1] - myImage.geometricBounds[1];
    myImage.move( undefined, [diff,0] );
    break;
    catch(e)
    myDocument.save('//Server_IP_Address/InDesignDocument_File_Path/Sample.indd');
    var previewFile = File('//Server_IP_Address/Images_to_be_reolaced_Path/ImageFile.jpg');
    app.jpegExportPreferences.jpegQuality["JPEGOptionsQuality.low"];
    app.documents.item(0).exportFile(ExportFormat.jpg, previewFile);
    myDocument.close();
    I have very urgent requirement; if anyone have any idea; please suggest me. \
    It would be highly appreciable.
    Kind Regards,
    Prashant.

    http://www.automatication.com/selection-to-pdf-script.html
    Harbs
    http://www.in-tools.com

  • Display F4 values as TEXT ONLY on selection screen of Bex report

    Hi,
    I have InfoObject with text(short) loaded for it. In Bex report on selection screen, I need to display ONLY TEXT values when you do F4 for values. How this can be achieved? I get key & text both now.
    Please note that I have tried all below settings -
    1. Set Text in InfoObject maintenance screen.
    This setting is over-ridden if you have multiprovider specific settings defined.
    2. Set Text in Infoprovider Specific properties.
    Here if you do KEY only, it works.. if you do KEY & TEXT, it works... but if you do TEXT only, it DOESNT work. It works for filter F4 values after report is executed but doesnt work for F4 values on Selection screen. There is no way I am able to get TEXT only on F4 values on selection screen.
    3. Set Text in Query
    These setting defines how value is displayed on report output. Nothing to do with F4 or Filter values.
    Thanks
    Abhijit

    Forgot to mention - I am on BI 7.0 & Frontend 3.5
    Thanks
    Abhijit

  • How to make a script for find text object?

    Hi everyone
    I want to make a script for find and select text object and then find next, find next, and so on, but without any open dialog
    Is that possible make a script for this?
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "(\[\x{2022}\])|(\x{25CF})";
    app.findGrep();
    thanks
    Regard

    You already have that. A script does not 'find, select, find next' - it finds all texts as soon as you execute the 'app.findGrep' command.

  • Use Story to create a script for subtitle text

    I have found a way to use the Speech Analysis through After Affects to create subtitles. However, the film I am making is a documentary and in a foreign language. We have the transcripts of the translated speech and I need to get that into Premiere and eventually After Effects to create the visual subtitles.
    I have seen some threads on using Story to enter transcripts, but I'm new to this Story application and can't figure out how to use it for what I want. I need to assign the text I have to a specific place on the clip. Can Story (and/or Premiere) do this and how do I do it?
    I have assigned a scene number then some text, but nothing is showing up in the clip's metadata with the script assigned to it.
    Any suggestions? Any other ideas for getting text assigned to timecode points for subtitles?
    Thanks.

    If you are looking at attaching the story scripts (scene's) data to the clips metadata please follow the instructions from this thread
    http://forums.adobe.com/thread/1043216?tstart=0

  • Good Codec for a text only video to export to iDVD

    I am making a video entirely of text because it's a transcript of a 911 call.
    I have saved it to a few different codecs- NTSC/ DV, 8 bit compression, animation, graphics and when I burn it to a DVd using iDVD, it looks like garbage.
    It's a combination of Boris 3D, regular text and a livetype background.
    Any ideas?

    18 pixel high text is too small. Even if I have just a couple of lines of static text, then I never go smaller than 22 pix.
    Your text only video should probably be more like 26-28 pixel text. Tiny text can get irritating very quickly for the viewer, especially if it is moving and it won't hold up to compression at all.

  • Free script for replacing multiple footage files

    Hello!
    I made a simple script for easily changing multiple footage paths. I'm a 3D artist and found it a burden to replace all the vray render passes every time I rendered a new version. I'm sure it has other uses as well, like checking and setting which of your footage files are local and which ones are on a fileserver.
    You can also copy and move footage from one file to another with this tool.
    I'm not a professional scripter and would like some comments and crits. What would be the best place to publish something like this? For 3ds max there's scriptspot.com, is there something similiar for adobe scripts?
    Use at your own risk. Download here.

    looks useful for managing multipasses. Have a look at aescripts.com for publishing your script.

  • Html scripts for changing texts

    does anyone have an html snippet code for flashing text like on the hot news headlines at the bottom of the apple home page - i have located scrolling text - but not flashing, or changing text? thanks

    I just posted javascript snippet couple days ago to rotate images:
    http://discussions.apple.com/thread.jspa?messageID=7079863&#7079863
    The same method can be used for text head liners, however it's depend on how the head liners are supplied.
    If you have to supply the head lines, you are on your own; you'll have to update them.
    or you can use some ready made such as BBC: http://news.bbc.co.uk/nol/ifsnews/hi/frontpage/ticker.stm
    or you can use webclip, webclip makes part of a web page into Dashboard widget, then process Dashboard code into HTML code. Anyway, here is Apple header liners in webclip: http://hdl.50webs.com/Dashboard/Widgets.html

  • How to get only the selected layer data?

    Hi All,
              I'm using dissolve sample plugin. I added two layers in photoshop both of different dimensions, say 1000 * 1000 & 2000 * 2000. Now I select the layer with 1000 * 1000 dimension and click on Dissolve plugin. The preview image what is shown in dissolve plugin dialog is not just the selected layer, but also some extra pixels around the selected layer.
    Do I need to set any flag for getting only selected layer data to display in preview?
    Also I need to get only the selected area in a particular layer. When I checked FilterRecordPtr, haveMask flag is TRUE if the part of the layer is selected. But how do I get only the part of the layer that is selected for displaying preview image?
    Please let me know if the description is not clear.
    Thanks,
    Dheeraj

    Thanks Tom Ruark for the response.
    That is exactly the same thing what I'm seeing.
    1.Is there a direct way to know the bounds of the layer without the transparency grid so that I can show only the layer?
    2. If I select an area of 50*50 within a layer(1000*1000) using Rectangular Marquee tool, then I want only that selected area to be shown in preview. For this there is a haveMask flag which indicates whether or not there is selection, but the selected bounds are not available. I'm currently calculating the bounds. I just wanted to know if Photoshop SDK has any field for getting the bounds?

Maybe you are looking for