Name of script

Hi all

For my needs, I want to get a list of all elements on the page with the 'id' value in the style of script.

Script Label entirely new concept for me.

Script below to get the value of the ID of each elements on the page in the active document.

But I don't know how to record all values [alert (("ID:" + myPgItems) in the script title.)]

Try the script:

myDoc = app.activeDocument var

var myPageItems = myDoc.allPageItems

Alert (myPageItems.Length)

for (i = 0; i < myPageItems.length; i ++)

{

var myPgItems = myPageItems [i] user.user

Alert ("ID:" + myPgItems)

}

Please find the attachment for more information

Screen Shot 2013-02-05 at 12.12.28 PM.png

Kindly give solution immediately.

Thanks in advance

BEGINNER

Hi BEGINNER,.

1. Why don't you store data in the label of the document?

2. to facilitate the comparison of IDs (new objs and/or those removed), a structure of object may be easier than a table.

Here's a possible approach (although not optimized):

function createList(/*PageItem[]*/a)
// -------------------------------------
{
    var i = a.length,
        r = {};

    while( i-- ){ r['_'+a[i].id]=null; }
    return r;
}

function compareList(o1, o2)
// -------------------------------------
{
    var k, a=[], z=0;

    for( k in o1 )
        {
        if( o2.hasOwnProperty(k) ) continue;
        a[z++] = k.substr(1); // as k is in the form '_id'
        }
    return a;
}

function showReport(oldList, newList)
// -------------------------------------
{
    var r = [],
        a;

    r[0] = (a=compareList(newList, oldList)).length ?
        ("NEW ids: " + a.join(" | ")) :
        ("No NEW item.");

    r[1] = (a=compareList(oldList, newList)).length ?
        ("REMOVED ids: " + a.join(" | ")) :
        ("No REMOVED item.");

    alert( r.join("\r") );
}

// -------------------------------------
// MAIN
// -------------------------------------

var doc = app.activeDocument,
    s = doc.label,
    // ---
    oldList = s && (new Function('return '+s)()),
    newList = createList(doc.allPageItems);

if( oldList ) showReport(oldList,newList);

doc.label = newList.toSource();
alert( "Data properly saved." );

@+

Marc

Tags: InDesign

Similar Questions

  • Change of name backwards script

    Hey there, I currently have a script (which I wrote) for all the renameing of layers in a document, but for the moment, it renames them in sense opposite, 0 upwards and downwards, counting, I was hoping that someone could help me out to count up from the bottom instead.

    Here is the script

    var app.activeDocument = docRef;

    var prompt = newName ('what is the basis of the new name', 'Frame');

    var myNB = docRef.layers.length;

    for (i = 0; i < myNB; i ++)

    {

    var finalName = newName + i;

    docRef.layers [i] .name = finalName

    }

    See you soon,.
    -Ford

    Hi M0man,

    It's easy just replace:

    var finalName = newName + i;

    by

    var finalName is newName +(myNB-i);. If you want this county at the 1 finish

    or

    var finalName = newName + (myNB-i-1); If you want this finish of count to 0

    Bye, art.chrome

  • Change the default name/location 'Scripts '...

    I find the ability to change the Spry folder name and location under Site to change settings.

    Is there an option to change the name of the Scripts folder and location as well?

    I know that I can move them manually and update the paths, but I thought that option may be configurable somewhere - even outside of the user interface.

    Hello

    Unfortunately, this cannot be changed, unless you want to go to the dreamweaver Configuration folder, locate the extension spry script and change it in the code (not recommended).

    PZ

  • find a block of text on the page with the name of script

    Hi all

    I need to create a script for

    find a block of text on the page with the script titled "xxx".

    and read its contents into a variable.

    The content of the text block is a number.

    Thank you

    Hello Roberto,

    Welcome to the forum,

    This is the textFrame marked on the current page.

    var myLabel = "Foo", // change to label
          myPage = app.properties.activeWindow && app.activeWindow.activePage,
          myTextFrames = myPage.textFrames.everyItem().getElements().slice(0),
          l = myTextFrames.length,
          myVariable
    
    while (l--) {
        if (myTextFrames[l].label != myLabel) continue;
        myVariable = myTextFrames[l].contents;
        break; // presuming there's only one "Foo" labeled frame on the page
        // Otherwise you'll nead an array
        }
    
    alert(myVariable)
    

    Trevor

  • Ungroup by clusters of Clusters of script name

    So I hope I'm missing something, rather than what is a limitation of LabVIEW.  I want to drop a Unbundle by name using scripts, then connect up to a cluster and set the unbundle by name, either an element within a cluster, of the latter.  I can do all of this with the exception of the cluster of a part of the cluster.

    Attached is a VI recorded in 2015 with a wired unbundle already to a cluster with cluster in it.  I have a second VI that attempted to change this VI by setting the unbundle for internal cluster name.  When I do this, I use the property of element names giving Core.Event error where rests on a cluster, and the error event is another.  The VI also returns the available names and the internal cluster is not listed as an option.  Is not possible to create a name unbundle that separate a cluster in the cluster?  Thank you.

    Try to write to the property ' element names [] complete. "

  • Issue of Script CUE, pronounced name

    Hello

    I have a script standard auto on a system of IDENTIFICATION of ver 2.1.1. If the person called is a subscriber of the unit and records a name spoken, I would like to play it back to the caller as a confirmation. I have this job by following the steps of the Extension of the user and read information from the user. If the Subscriber has not registered a pronounced name, the script errors out with a message of "system problems". I assumed that, given that the pronounced name is null. Is there a way to check a valid registered name before trying to use it as a guest?

    Thank you

    Dave Windorski

    If you are using a read the user information, you can set the attribute name spoken in a varialbe, say the spokenName (which is a kind of Document). You can tell a step if (spokenName is nothing), the step create generated prompt allows to set a guest spoken of the phone number. Then you can play the version spoken of the extension. If (spokenName == null) is false, then you can play the recorded name.

  • Add a Notification Script custom BB

    Hello

    I wish I could have custom BB according to disk space notification scripts. We have a DBA who would like to be alerted to 80%, but we want to stay in bed until at least 90% or maybe 95%. Is this possible? Also, I wish I could take all the text in the alert, leaving only the host name and the problem. We have no need for the links of the acknowledgement of receipt sent to each alert.

    Thank you

    Brandon

    Brandon,

    You can generate custom notifications from the BB management servers that are running on UNIX/Linux platforms. Custom notification scripts can be found in $BBHOME/ext/pg on the BBServer and are called by the notification rules that start with 'ext-', followed by the name of script and a hyphen 'scriptname-', followed by an e-mail address. A notification for a custom script rule might look like:

    *;; *;; *;*;*; [email protected]

    You can read all about how to create a custom notification script by launching the BBServer online help documentation and search for 'Create a custom notification Script'.

  • Starup-Script: If the file is locked (open elsewhere), opened as a copy

    Hi Scripting Aces.

    I am looking for a script (start) - or something similar, which addresses the following problem, listen to me and my colleagues in InD for the years:

    While navigating with the Finder on your server, or a glance on a folder you're working in, you want to open an InD - doc by double-clicking on it.
    Or, to put my belongings in a predefined folder I use a script, and I do not have the 'open as copy' - option it by throwing an app.place (pathToPredefinedFolder.openDlg ('Get some files', ' *. *', true)).

    Then, you come to this file to open, and then you find out: someone has opened (its locked)-you must cancel your open procedure and return to the navigation road with the native, to have this option dialog InD.

    What happens if... (Style ancient Aliens :)

    -a startup script manager oversees 'trys to open', if this fails due to the closure, while it opens the file as a copy.

    -neat would be a dialogue snazzy "locked file. Open as copy? »

    -Super-neat would be: files that are OpenedAsCopy becomes without NAME - 1, but as I know the file name, the script could change the docname the filename, I tried to open it (with _COPY added to the name of).

    I wonder, because I imagine to be coded quite easy, why no one else bothered him now. Although it could be a small feature added in the next versions of InD that does not hurt.

    Hello

    1st idea:

    Script could check if ~ thisDoc ~ * IDLK file exists when opening and continue in the CONTRARY case or openAsCopy If YES.

    2nd idea:

    If the target files are sources of content to copy ==> have you considered using (INDL) library files that actually can be opened by several at the same time?

    Jarek

  • Add titled script Inline graphic

    Hello

    I currently have a document containing thousands of inline .eps icons I want the tag with a name of script that the icon is located.

    So far, I have the following text which does not...

    Tell application "Adobe InDesign CC 2015"

    tell document 1

    Repeat with the target (charts all get stories)

    If the name of the target of the link contains "File1" then

    label of the parent of the parent of the target to 'file1 '.

    end if

    end repeat

    tell the end

    tell the end

    I have what works, but I need to test different names of individual link to the script tags...

    Tell application "Adobe InDesign CC 2015" of 1, rehearsing with the target objects (graphics all get stories)-anchored

    label of the parent of the parent of the target to 'file1 '.

    end repeat

    Thank you

    Shane

    Hi Shane;

    Try this javascript if it works will convert the same in AppleScript.

    myDoc var = app.activeDocument;

    var myGraphics = myDoc.stories [0] .allGraphics;

    for (var i = 0; i)< mygraphics.length="" ;="">

    {

    var myName is myGraphics [i].itemLink.name;.

    myName = myName.replace (".eps","" ");

    myGraphics [i] .label = MyName;

    }

    Thank you

    Ravindra

  • How to remove colors custom Script UI control?

    Dear forum,

    I am writing a script for batch renaming links in InDesign.

    1.jpg

    If the user types the text edit field the new name which coincides with name of the original link (1st static text in the Group), the script gives a warning and he painted red.

    2.jpg

    3.jpg

    When the user solves the problem by making the new different name, the script he painted black.

    15-11-2015 20-30-37.jpg

    Here's where I got so far:

    g.et.onChange = function() {
        if (this.parent.children[0].text.replace(/\.[^\.]+$/, '') == this.text) {
            alert("\"" + this.text + "\" - the new name is the same as the old one! The file won't be renamed.", "Error", true);
            this.graphics.foregroundColor = this.graphics.newPen(this.graphics.PenType.SOLID_COLOR, [1, 0, 0], 1);
        }
        else {
            if (this.graphics.foregroundColor != undefined) {
                $.writeln("Names are different: change the name from red to black.");                        
                this.graphics.foregroundColor = this.graphics.newPen(this.graphics.PenType.SOLID_COLOR, [0, 0, 0], 1);
            }
        }
    }
    

    "g" is the text in a group.

    I wonder, is there a way to reset the color to the default text instead of repainting it?

    Currently, it checks if foregroundColor of graph is not undefined - which is painted with "newPen" - and if it is true, he painted black. But I guess it is a clumsy workaround and there should be a good way to do this.

    Kind regards

    Kasyan

    Hi Kasyan

    Pre CC could set the color to null, CC, this causes an accident.

    PS there are other options (color theme), but not on ID so paint is the only option I know.

    The challenge is dealing with default colors that depend on the setting. To change the text in the foreground is always black background colors you can either take the approach here Re: Re: Re: Re: ScriptUI: element of change to the default color

    Or a longer but more effective approach would be to go pass 100 values possible topic and get the associated rgb values.

    Probably not interesting put in a lot of effort as the way things are going THAT SUI will not support editing text in a few years.

    Concerning

    Trevor

  • Script VBS to post-synchronization QuickPrep failed

    We have the post-synchronization script VBS script but the Agent could not run. Here is the log:

    Ready for NEWS - running the script PostSync: "C:\Windows\System32\cscript.exe C:\script\psview.vbs' with timeout: 120000

    Comments FATAL - RunScript: cannot run the script: 00DB2088, error = 2

    FATAL Ready - cannot run PostSyncScript: "C:\Windows\System32\cscript.exe C:\script\psview.vbs"Unable to create processes for the scriptError 2 (0x2): the specified file is not found. "

    The error "Specified file cannot be found" means "file not found".

    The script is present on the image of the mother and the path is correct. There is no problem to run the script when you are logged on the machine with the same exact line: "C:\Windows\System32\cscript.exe C:\script\psview.vbs.

    We follow the VMware KB 1026999 and there is no indication that the VBS is not supported. The workaroud is to call a. BAT script as looping script. It. BAT calls the VBS script and works. Here what this KB says:

    If you use a scripting language that needs an interpreter to run the script, the script path must start with the binary interpreter. For example, C:\windows\system32\cscript.exe c:\script\myvb.vbs.

    Someone at - it clues to this topic? Thank you

    Finally, we found the resolution. It is not well indicate in Administration but guide in "customization" section in the settings of the pool, there are two fields:

    The file name of script-online put C:\windows\system32\cscript.exe

    The script parameters => put the ie C:\script\psview.vbs script file name

    See attached file.

  • VMDK_FILES_TO_BACKUP: Vmdk bearing the same name

    What I will meet the following when you try to install ghettoVCB.

    I want than backup discs connected to the VM Windows to exclude from ghettoVCB. We have 2 data warehouses, one with al main drives and the other with backup discs. Since we have 2 data warehouses these two discs VMDK names are identical. How can I specify the backup disk to be excluded when runnning ghettoVCB or is there a possibility to exclude a whole routine backup data store?

    Hi SteeWell,

    As @jpgillivan said, it's probably a good idea not to have the same name right for VM even VMDK as it can become confusing if you must manually manipulate an individual disk, but that said, it's always a taken use case supported by ghettoVCB.

    First of all, you can have the computer virtual disk extend store multiple data, and usually when you so, host ESX (i) will automatically ensure the VMDK (s) is unique, at least that's what I saw in ESX (i) 4.x and 5.0. The only way that I knew you could get EXACTLY the same name is that if you renamed manually the VMDK (s), otherwise if you have to say 2 VMDK (s) which is spread over two data stores they would call something like this by VMware:

    [datastore 1] myvm/myvm.vmdk

    [datastore 2] myvm/myvm_1.vmdk

    As you can see, the two VMDK (s) have unique names and there are a number that auto-increments based on the number of VMDK (s) and this would allow you to easily exclude or include the VMDK (s) you want to backup.

    In any case, if you had somehow the following configuration:

    [datastore 1] myvm/myvm.vmdk

    [datastore 2] myvm/myvm.vmdk

    which is always supported in a perspective of ESX (i), the good thing about how it is actually stored in the .vmx file is the full path to other VMDK (s) who don't residence not in the backend configuration data. (e.g. vmfs/volumes / [datastore uuid]/myvm/myvm.vmdk). ghettoVCB will then list the VMDK (s) the user wishes to exclude and then match it against the list of the VMDK (s) identified by users.

    So here's an example:

    TEST has 2 VMDK (s)

    * TEST.vmdk (located in the same directory as the .vmx)

    * TEST.vmdk (located in another data store)

    If you have run just dryrun mode, you will see the following text:

    2011-11-20 23:17:58 - dryrun: #.
    2011-11-20 23:17:58 - dryrun: Virtual Machine: TEST
    2011-11-20 23:17:58 - dryrun: VM_ID: 2983
    2011-11-20 23:17:58 - dryrun: VMX_PATH: /vmfs/volumes/himalaya-local-SATA-intel.510:0/TEST/TEST.vmx
    2011-11-20 23:17:58 - dryrun: VMX_DIR: /vmfs/volumes/himalaya-local-SATA-intel.510:0/TEST
    2011-11-20 23:17:58 - dryrun: VMX_CONF: TEST/TEST.vmx
    2011-11-20 23:17:58 - dryrun: VMFS_VOLUME: Himalayas local SATA intel. 510:0
    2011-11-20 23:17:58 - dryrun: VMDK (s):
    2011-11-20 23:17:58 - dryrun: /vmfs/volumes/4d8abe51-234bb8da-6db2-003048d9586b/TEST/TEST.vmdk 2 GB
    2011-11-20 23:17:58 - dryrun: TEST.vmdk 1 GB
    2011-11-20 23:17:58 - dryrun: VMDK (s) INDEPENDENT:
    2011-11-20 23:17:58 - dryrun: TOTAL_VM_SIZE_TO_BACKUP: 2 GB
    2011-11-20 23:17:58 - dryrun: #.

    If you only wantd to TEST.vmdk, then your backup config would look like:

    VMDK_FILES_TO_BACKUP = "test.vmdk"

    If you want only the other TEST backup. VMDK, then your config would be loo like:

    VMDK_FILES_TO_BACKUP="/vmfs/volumes/4d8abe51-234bb8da-6db2-003048d9586b/test/test.VMDK".

    As you can see, even if the virtual machine has 2 VMDK (s) exactly the same name, the script is able to determine that you want to backup, as long as you specify the path to the desired VMDK.

    I hope this makes sense

  • Ability to share scripts among users on the same Mac

    Hello

    In our design studio, we use InDesign with some scripts to automate tasks. The problem is that when a change of users from one Mac to another, scripts must be installed manually in the correct location. Is it possible that I can put the scripts in a folder (say/use/share/Indesign_Scripts") and that Indesign always uses this place?

    For now, I copied the scripts in the user model in / etc, but this doesn't always work because some users use different language settings (en_GB-> en_US)

    Hello

    Shortcuts are good, even if some people are getting lost in front of alerts "Cannot find the original file"..., but not in Design Studio, I'm sure.

    I tried another way that works, so there is no reason to keep this hide.

    3 types of scripts:

    -----------------------

    1 - simple one is placed in the 'Startup Scripts' folder of each user:

    It looks like this:

    #targetengine "menu"
    var myScPath = "~/Shared/Scripts/Studio_menu.jsx";
         if (File (myScPath).exists)
                      app.doScript(File(myScPath));
         else alert ("No network file find..., or whatever alert");
    

    -----------------------

    2nd is menu loader (' Studio_menu.jsx), so this one 1 script calls while ID begins.

    It looks like this: (thanks to Marc Autret)

    #targetengine "Scripts"
    
    var fcaTitle = "Scripts";          // name (parent menu item) displayed in ID menu
    var fcaSubTitle1 = "&Task1";     // name (name of script) displayed in ID menu
    var fcaSubTitle2 = "&Task2";    // name (name of script) displayed in ID menu
    
    var fcaHandlers1 = {
              'beforeDisplay' : function(ev1)
                        {
              mySc1Path = "~/Shared/Scripts/Task1.jsx";     // script, executor of task 1
              ev1.target.enabled = File(mySc1Path).exists;
                        },
    
              'onInvoke' : function()
                        {
                        app.doScript(File(mySc1Path));
                        }
              };
    
    var fcaHandlers2 = {
              'beforeDisplay' : function(ev2)
                        {
              mySc1Path = "~/Shared/Scripts/Task2.jsx";     // script, executor of task 2
    
              // conditions to enable/disable menu item
              ev2.target.enabled = File(mySc2Path).exists && app.documents.length > 0 && app.activeDocument.saved;
                        },
    
              'onInvoke' : function()
                        {
                        app.doScript(File(mySc2Path));
                        }
              }
    
    var fcaMenuInstaller = fcaMenuInstaller ||
    (function(mnuTitle, mnuSubTitle1, mnuSubTitle2, mnuHandlers1, mnuHandlers2)
    {
    // 1. Create the script menu action
    
    var s1mnuAction = app.scriptMenuActions.add(mnuSubTitle1);
    var s2mnuAction = app.scriptMenuActions.add(mnuSubTitle2);
    
    // 2. Attach the event listener
    var ev1, ev2;
    for( ev1 in mnuHandlers1 )
              {
              s1mnuAction.eventListeners.add(ev1,mnuHandlers1[ev1]);
              }
    for( ev2 in mnuHandlers2 )
              {
              s2mnuAction.eventListeners.add(ev2,mnuHandlers2[ev2]);
              }
    
    // 3. Create the menu item
    var fileMenu = app.menus.item("$ID/Main").submenus.item("$ID/&Help");  // new menu item's location
    
    var SubMenu = fileMenu.submenus.add(mnuTitle,LocationOptions.AT_BEGINNING);     // where
    var SubMenu1 = SubMenu.menuItems.add(s1mnuAction,LocationOptions.AT_END);
    var SubMenu2 = SubMenu.menuItems.add(s2mnuAction,LocationOptions.AT_END);
    
    return true;
    })(fcaTitle, fcaSubTitle1, fcaSubTitle2, fcaHandlers1, fcaHandlers2);
    

    ---------------------

    3rd are the real script files placed somewhere in the network (mySc1Path1, mySc1Path2)

    Users call scripts in the menu.

    Admin, updates them easly.

    Jarek

  • script to rename the layers in alphabetical order

    Hello world

    I have a name change script that works only on the numbers and I want to make it work for the letters too.

    What I want to achieve is to select a few layers-> load the script-> enter the desired name of the layer and brackets insert the letter of where to start. The script then iterates through the alphabet rename the layers and adding the letter from coresponding to the name and remove the brackets. For example, I select 4 layers, loading the script and when the guest comes on... Enter the name: test [C]. In the end, that I should have renamed layers testC testD, tests, testF

    Any help would be appreciated!

    Thank you

    So what you wanted, it is for renaming selected objects, no layers, right?

    Check this script, I took a different route, I added some comments, if you have problems with it, do not hesitate to ask

    // this script Renames selected Objects with a base name plus an incremental suffix
    // Carlos Canto // 07/03/2013;
    // http://forums.adobe.com/thread/1243774?tstart=0
    
    var doc = app.activeDocument;
    var sel = doc.selection;
    var rename = prompt("Enter the name and ONE character suffix (comma separated, no space):","test,A", "Increment Rename Selected Objects");
    if (rename!=null) {// quit if pressed Cancel
        var nameArray = rename.split(","); 
    
        var base = nameArray[0];
        var suffix = nameArray[1];
    
        var charCode = suffix.charCodeAt (); // convert the suffix character to Unicode
    
        if(sel.length>0){
            for(var z=0;z		   
  • Title of table Script

    Hello

    I am new to scripting indesign and use javascript / extendscript.   I paginate a document and get an array of all the tables in the paginated document using

    var myTables = myDoc.stories.everyItem ().tables.everyItem () .getElements ();

    I then walk through them in a loop a conditionally applying a block of code.

    I need to do a little smarter and to apply different blocks of code based on the name of script.  I would like to be able to:

    if(mytables[i].label=="1") {... do this code...}

    Else if(myTables[i].label=="2") {... do this code...}

    The problem is that I can assign a script for the table heading is found in the block of text, but not the table itself, it seems.  If that is correct, is there an easy way for me to get title of the tables the array element text frame script (I'm currently sitting on my myTables loop [i])?

    Please speak slowly, or it is likely to fly right by me

    Thank you

    David

    In fact, you CAN assign a script label to a table, either in a script or in the InDesign UI.  User interface methods are probably a little obscure... for example see http://www.peachpit.com/articles/article.aspx?p=415190&seqNum=13 for a description.

Maybe you are looking for