XML Comment in Indesign using Apple script.

Hi all,
How to find the selected XML element is commented in indesign and get XML comment value in thru apple script. Any Ideas?
-Jacintha

You can have as many comments as you want so they require you to state the index of the comment in your reference.
Assuming you have an object reference for the XML element, you would replace "associated XML element of selection" with that.
tell application "Adobe InDesign CS3"   
    set myComments to {}
    if every XML comment of associated XML element of selection is not {} then
        set end of myComments to value of every XML comment of associated XML element of selection
    end if
    return myComments
end tell
if you know there's only going to be one comment then,
tell application "Adobe InDesign CS3"
    if every XML comment of associated XML element of selection is not {} then
        set  myComment to value of XML comment 1 of associated XML element of selection
    end if
    return myComment
end tell
~Mike

Similar Messages

  • Find raster Image & Vector image in adobe indesign using apple script?

    Find raster Image & Vector image in adobe indesign using apple script?

    Find raster Image & Vector image in adobe indesign using apple script?

  • Exporting Secured PDF from indesign using apple script

    hi there, this is my first go at scripting,
    basically what i am trying to do is:
    tell indesign to turn on a layer called "proof" in the active document
    then export pdf - set pdf preference to smallest file size, all pages, and secure the file WITH A PASSWORD so that it can be opened but not edited (unless by someone at my agency who knows this password). this easy enough to manually, but im sick of typing out a password everytime i save a proof.
    then save to a specific folder on the desktop, using the already existing filename - so 'myfile.pdf'
    the code below gives me this message "
    error "Can’t make name of PDF export preferences into type Unicode text." number -1700 from name of «class DFpf» to Unicode text
    could someone please help me word this properly? I tried first referring to a pdf preset instead of setting all the values ie set color bitmap etc but i couldnt get the password to work,
    here is what i have so far, written from snippets that other people have tried:
    tell application "Adobe InDesign CS4"
              tell active document
      try
                                  set visible of layer "PROOF" to false
                        end try
      set docName to name
                        set baseName to text item 1 of docName
                        set ASTID to AppleScript's text item delimiters
                        set AppleScript's text item delimiters to "."
                        set AppleScript's text item delimiters to ASTID
              tell PDF export preferences
                        set acrobat compatibility to acrobat 4 --> create a 1.3 pdf
                        set use security to true
                        set disallow changing to true
                        set disallow copying to true
                        set disallow document assembly to true
                        set disallow extraction for accessibility to true
                        set disallow form fill in to true
                        set disallow notes to true
                        set disallow hi res printing to false
                        set color bitmap sampling DPI to 100
                        set grayscale bitmap sampling DPI to 100
                        set monochrome bitmap sampling DPI to 100
      --set image quality
                        set color bitmap quality to minimum
                        set grayscale bitmap quality to minimum
      --set fonts
                        set subset fonts below to 0
      --set security
                        set use security to true
                        set change security password to "editedit"
                        set disallow extraction for accessibility to false
                        set disallow copying to true
                        export format PDF type to "/Users/kimwilson242/Desktop/_PROOFS/" & name & ".pdf" without showing options
              end tell
    end tell

    tell application "Adobe InDesign CS5"
      -- prefs belong to app so use in tell app block
              tell PDF export preferences
                        set acrobat compatibility to acrobat 4 --> create a 1.3 pdf
                        set use security to true
                        set disallow changing to true
                        set disallow copying to true
                        set disallow document assembly to true
                        set disallow extraction for accessibility to true
                        set disallow form fill in to true
                        set disallow notes to true
                        set disallow hi res printing to false
                        set color bitmap sampling DPI to 100
                        set grayscale bitmap sampling DPI to 100
                        set monochrome bitmap sampling DPI to 100
      --set image quality
                        set color bitmap quality to minimum
                        set grayscale bitmap quality to minimum
      --set fonts
                        set subset fonts below to 0
      --set security
                        set use security to true
                        set change security password to "editedit"
                        set disallow extraction for accessibility to false
                        set disallow copying to true
              end tell
      -- now deal with the doc
              tell active document
                        try
                                  set visible of layer "PROOF" to false
                        end try
                        set docName to name
                        set baseName to text item 1 of docName
                        set ASTID to AppleScript's text item delimiters
                        set AppleScript's text item delimiters to "."
                        set AppleScript's text item delimiters to ASTID
      -- use flexible path to user desktop… path strings are HFS (colon delimited)
                        export format PDF type to (path to desktop as text) & "PROOFS:" & name & ".pdf" without showing options
              end tell
    end tell

  • Can I use "apple script" to auto input xml file to final cut pro and auto export mp4 file?

    Now, I'v a lot of  final cut pro x 's xml, I want to use ""apple script" or other method to auto input xml and output mp4 in final cut pro x . How can I finish it?

    Where did the XML come from? What did it consist of?

  • Sending email using apple script...

    I have created a watch folder using apple script that when a file is dropped on it, it automatically opens, formats, and sends out a custom email.
    What I don't understand is, how can I include multiple variables in the "content" section (also known as the body section of the email)? I want to put custom type in the content section that says "There is a file awaiting your review." I also would like to choose an email signature from my mail program to use. Third, I would like to include the name of the file that is being sent....
    I found that by doing {content:iteminfo} I could get the file name...If I do {content:"There is a file awaiting your review."} I could get the custom type I wanted....
    BUT, I can't figure out how to get BOTH of them together in ADDITION to adding a custom email signature...
    I know there are some really smart people out there...Any tips?

    I can't figure out how to get BOTH of them together
    This is just standard AppleScript text concatenation with the &:
    ... {content: "There is a file awaiting your review: " & iteminfo}
    Here you can see I'm concatenating a literal string (enclosed in quotes) and a variable. You can extend this ad infinitum.
    As for the signature:
    tell theMessage to set message signature to signature "My Sig"
    (which assumes you have a signature named 'My Sig'. Adjust as necessary.

  • How to disable the option of "Overprint [Black] Swatch at 100%" in Indesign by Apple Scripting

    Hi Friends,
    I am new to Indesign Scripting by Apple Script. As a beginner, I am trying to do some basic scripting in Indesign by Apple Script.
    My aim is to disable the option of "Overprint [Black] Swatch at 100%" in Indesign. This option is available when we go to Indesign ---> Preferences----> Appearance of Black.
    Also, if a user opens a file, in which the swatch is already enabled, then it should prompt him for disabling.
    I can make a display dialog in AppleScript. But, I am bit unsure as how can I go ahead and disable this option. I tried this below script:
    tell application "Adobe InDesign CS4"
          tell every layout window to set overprint preview to false
    end tell
    However, it is changing the view option to overprint preview.
    Appreciate your help and suggestions!
    Thanks,
    Abhishek

    tell application "Adobe InDesign CS5"
              tell the active document
                        set overprint black of document preferences to false
              end tell
    end tell

  • Help with moving contact info using Apple Script in Address Book

    Hi folks,
    I wonder if someone can help? I imported a few hundred contacts via a Gmail created vCard into my Address Book. The problem is that instead of inserting the email addresses into one of the email fields for each record, it has inserted the email address into the Notes field as follows: "EmailAddress: [email protected]".
    I would like help to write an Apple Script that will search my contacts in Address Book, find those with "EmailAddress:" in the notes field, cut the email address that follows it, and pastes it into the Work Email field, carries out the operation for the whole address book and saves the changes.
    Can anyone help me write a script for this. I've not used Apple Script before so this will be my first attempt!
    Thanks in advance,
    ayworld

    This should work:
    tell application "Contacts"
      activate
              set thePeople to every person whose note contains "EmailAddress:"
              set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
              repeat with thePerson in thePeople
                   set nn to thePerson's note
                    make new email at end of emails of thePerson with properties {label:"Notes", value:text item 2 of nn}
              end repeat
      save
    end tell
    It will leave the entry in notes and make the label of the new email 'Notes"
    Normally when I post an AppleScript like this I tell the user to test it out before using it on the actual data but in this case I don;t know how you'd do that given there is only one Contacts and only one Contacts database.
    Just make sure you have a backup just in case. I tried it here on some dummy entries in my Contacts and it worked OK.
    Again this totaly relies on the data you presented. The Notes field has to be in the format
    EmailAddress:[email protected]
    for this to work.
    regards
    Message was edited by: Frank Caggiano - If you select all the text in the box, then right click and select Make new AppleScript the script will open in the AppleScript editor. Just make sure you get all the text it is easy to drop the first or last char when selecting.

  • How create indesign using Java Script

    I am new in indesign and want to create indesign application using JavaScript.
    When i use AppleScript to create Indesign Application i use this statement
    tell application "Adobe InDesign CS5.5"
    set myDocument to make document with properties
    end tell
    Indesign Application create sucessfully.
    How create Indesign Application using JavaScript ?
    or what is equivelent statement of ( tell application "Adobe InDesign CS5.5" ) in Java Script.
    There are some java scripting example given on forum or in sdk.These all example start with app.
    when I debug these java script using ExtendScript ToolKit 3.6 It give error on app (undefined app).I think this app ia application object.
    How create  indesign application object  app in javascript ?
    While this script run sucessfully when i put these script in C:\Program Files\Adobe\Adobe InDesign CS5.5\Scripts
    and to run these script use Scripts panel (choose Window > Utilities > Scripts), then double-click the script name in the Scripts panel in indesign application.But In this case first i start indesign application and then choose Window > Utilities > Scripts then double-click the script name in the Scripts panel.
    I want to create Indesign Application (instance) using JavaScript.When I run or (debug) my JavaScript in any javaScript tool like ExtendScript ToolKit 3.6 then Indesign application should start, like in Apple Script.
    Thanks

    Thanks Vamitul for reply
    For example when i run SelectObjects.jsx An InDesign CS5.5 JavaScript in ESTK  then message prompt "Target Adove Indesign CS5.5 is not running. Do you want to lanch." Then on click yes Indesign application start.
    I want to Know how indesign object "app" is created to start Indesign application on click yes.
    http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/In DesignScripting/InDesign-ScriptingTutorial.pdf
    Like in VB to create indesign object we use CreateObject("InDesign.Application"). In javascript how create object say "app" of InDesign Application.
    For example if  i write
    var myDocument = app.documents.add();
    var myTextFrame = myDocument.pages.item(0).textFrames.add();
    myTextFrame.geometricBounds = ["6p", "6p", "24p", "24p"];
    myTextFrame.contents = "Hello World!";
    in a simple text file and save it with .js extention and to open this double click on this  it give error undefined "app".
    Source :Microsoft JScript runtime error
    So how define "app" or create indesign object ?
    Thanks

  • How to preserve XML comments in indesign cs4 document

    Hi,
    I have the below table xml with me:
    <?xml version="1.0" encoding="UTF-8"?>
    <informaltable xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid5:tablestyle="UNTABLE" aid:trows="4" aid:tcols="2" float="0">
    <!--tgroup aid:table="table" aid5:tablestyle="UNTABLE" aid:trows="24" cols="2" colsep="0" rowsep="0" align="left"--><!--colspec colnum="1" colname="c1" align="left" colwidth="25"/--><!--colspec colnum="2" colname="c2" align="left" colwidth="25"/--><!--thead--><Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="129" valign="top"><para aid:pstyle="CR_H1">Chronology:</para></Cell><Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="129" valign="top"><para aid:pstyle="CR_H1">14,000 Years Ago to 1590 c.e.</para></Cell>
    <!--/thead--><!--tbody--><Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="129" valign="top"><para aid:pstyle="CR_UNTBL"><emphasis aid:cstyle="BOLD" role="strong">14,000 years ago</emphasis></para></Cell><Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="129" valign="top"><para aid:pstyle="CR_UNTBL">Early Paleo-Indians in Florida and Pennsylvania regions, and also in Monte Verde, Chile.</para></Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="129" valign="top"><para aid:pstyle="CR_UNTBL"><emphasis aid:cstyle="BOLD" role="strong">13,900 to 12,900</emphasis></para></Cell><Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="129" valign="top"><para aid:pstyle="CR_UNTBL">Clovis hunters spread</para></Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="129" valign="top"><para aid:pstyle="CR_UNTBL"><emphasis aid:cstyle="BOLD" role="strong">years ago</emphasis></para></Cell><Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="129" valign="top"><para aid:pstyle="CR_UNTBL">across North America.</para></Cell>
    <!--/tbody--><!--/tgroup--></informaltable>
    I am able to import this xml in to indeisgn document successfully. But when I export the same table out of Indesign, the xml comment  <!--tgroup... is not exported.
    Is there any method to preserve the comment on export. Please suggest a solution for this.
    Thanks,
    Gopal

    You must include the comment() as one of the elements that you select to process.
    It is best to use xsl:value-of or xsl:copy-of with select="informaltable/comment()" to avoid processing comments from other parts of your XML file. In other words, always make the processing of comment() specific to the location where you need to extract the content of the comment.

  • Can I use Apple Script to press a button?

    Is there some way I can create an Apple Script to run and press a button in another application, or create a "plug-in" type script for the program to make the button into a something that can be used by a keyboard shortcut?
    I ask because I have an application that I can use to operate my digital camera, however, the button that Auto-Focuses then Shoots a photo does not have a keyboard shortcut. This is a problem because I also have the App "Snatch" on my iPhone, and, long story, short, I discovered I could use Snatch on my laptop on an Ad-Hoc network from about 1,000 feet away, maybe more. If I could find a way of making the "AF and Shoot" button into a keyboard shortcut, or create a script that could be triggered by a keyboard shortcut to press the button, I could use Snatch to control my camera remotely, far better then any part I would by from Nikon, or a third-party (Trust me, I have used a lot of them, and this method beats them all, save for the fact that I can't use bulb.)
    Anyway, thanks for any input, if any.

    Even if an application is not scriptable, you can generally use [GUI Scripting|http://www.macosxautomation.com/applescript/uiscripting/index.html] to press a button. For example, using Canon's RemoteCapture DC software, the script below will press the "Release" button of the main window:
    tell application "RemoteCapture DC" to activate
    tell application "System Events"
    tell process "RemoteCapture DC"
    click button 4 of window "RemoteCapture DC"
    end tell
    end tell
    If you then put the above script in the AppleScript menu in the menu bar, you should be able to use a third party application, like Quicksilver, to assign a keyboard shortcut to it.
    Message was edited by: Pierre L.

  • Concat apps that use Apple Script

    I have been using Split and Concat 2.5 for joining downloaded files. Around the time I upgraded to OS10.4.9 it began to refuse to open; instead the dock icon just bounced a few times and stopped. I tried the Application, but it still would not open. Similar symptoms were observed with MacHacha (all versions to 3.2) and Catenator 1.1.0. I reloaded the original programs, deleted what preferences I could find, and repaired permissions, all to no avail. JigSaw works OK, so I suspect the issue is with Apple Script. Any suggestions?
    Thanks,
    Geoff
      Mac OS X (10.4.10)  

    This is what the logs for Split and Concat and MacHacha read:
    2007-07-19 19:24:18.307 MacHacha[813] CFLog (21): Error loading /Users/geoff/Library/QuickTime/YV12ImageDecompressor.qtx/Contents/MacOS/YV12Ima geDecompressor: error code 4, error number 0 (Library not loaded: /Library/Frameworks/YV12ImageDecompressorGlue.framework/Versions/A/YV12ImageDec ompressorGlue
    Referenced from: /Users/geoff/Library/QuickTime/YV12ImageDecompressor.qtx/Contents/MacOS/YV12Ima geDecompressor
    Reason: image not found)
    2007-07-19 19:25:43.201 Split&Concat[817] CFLog (21): Error loading /Users/geoff/Library/QuickTime/YV12ImageDecompressor.qtx/Contents/MacOS/YV12Ima geDecompressor: error code 4, error number 0 (Library not loaded: /Library/Frameworks/YV12ImageDecompressorGlue.framework/Versions/A/YV12ImageDec ompressorGlue
    Referenced from: /Users/geoff/Library/QuickTime/YV12ImageDecompressor.qtx/Contents/MacOS/YV12Ima geDecompressor
    Reason: image not found)
    It seems that QuickTime is an issue but I am not sure what this all means. Thanks for your suggestion and any explanation would be more than welcome.
    Geoff

  • How to get latest added file from a folder using apple script

    Hi..
    I am trying to get a latest added file from a folder..and for this i have below script
    tell application "Finder"
        set latestFile to item 1 of (sort (get files of (path to downloads folder)) by creation date) as alias
        set fileName to latestFile's name
    end tell
    By using this i am not able to get latest file because for some files the creation date is some older date so is there any way to get latest file based on "Date Added" column of a folder.

    If you don't mind using GUI Scripting (you must enable access for assistive devices in the Accessibility System Preference pane), the following script should give you a reference to the last item added to any folder. Admittedly not the most elegant solution, but it works, at least under OS X 10.8.2.
    set theFolder to choose folder
    tell application "Finder"
        activate
        set theFolderWindow to container window of theFolder
        set alreadyOpen to exists theFolderWindow
        tell theFolderWindow
            open
            set theInitialView to current view
            set current view to icon view
        end tell
    end tell
    tell application "System Events" to tell process "Finder"
        -- Arrange by None:
        set theInitialArrangement to name of menu item 1 of menu 1 of menu item "Arrange By" of menu 1 of menu bar item "View" of menu bar 1 whose value of attribute "AXMenuItemMarkChar" is "✓"
        keystroke "0" using {control down, command down}
        -- Sort by Date Added:
        set theInitialSortingOrder to name of menu item 1 of menu 1 of menu item "Sort By" of menu 1 of menu bar item "View" of menu bar 1 whose value of attribute "AXMenuItemMarkChar" is "✓"
        keystroke "4" using {control down, option down, command down}
        -- Get the name of the last item:
        set theItemName to name of image 1 of UI element 1 of last scroll area of splitter group 1 of (window 1 whose subrole is "AXStandardWindow")
        -- Restore the initial settings:
        click menu item theInitialSortingOrder of menu 1 of menu item "Sort By" of menu 1 of menu bar item "View" of menu bar 1
        click menu item theInitialArrangement of menu 1 of menu item "Arrange By" of menu 1 of menu bar item "View" of menu bar 1
    end tell
    tell application "Finder"
        set current view of theFolderWindow to theInitialView -- restore the initial view
        if not alreadyOpen then close theFolderWindow
        set theLastItem to item theItemName of theFolder
    end tell
    theLastItem
    Message was edited by: Pierre L.

  • Install and uninstall of dmg file using Apple script in Mac 10.6 and higher version.

    Hi ,
    Could anyone please help me to write a Apple script to Install dmg file and do clean uninstall in Mac 10.6.8 and higher version.
    My requirement is:
    When i run script : it has to install the dmg file which is located inside one desktop folder say 'New Folder'
    I need to do clean unistall when i run the script: i need to delete the folder in ~/Library- locate folder say  'CPSPCSHOWSERVER'' move to trash and from Terminal type in command "rm -r ~/.CPS' to completely delte this folder.
    Really appreciated all ur help!!
    Thanks,
    KT.

    http://macfidelity.de/2008/08/30/how-to-mount-a-dmg-from-terminal-in-mac-os-x/in dex.html
    http://osxdaily.com/2011/12/17/mount-a-dmg-from-the-command-line-in-mac-os-x/
    http://hints.macworld.com/article.php?story=20030614230204397
    http://www.commandlinefu.com/commands/view/2031/install-an-mpkg-from-the-command -line-on-osx

  • Please help!! Using Apple Script in Automator for Quicktime

    I would like to add some metadata to a batch of quicktime movies and then make the files unable to be altered and re-saved so that I can post them on the web. If I open a movie in quicktime and run the following apple script I can then perform save as of movie A into movie B and movie B cannot be altered.
    tell application "QuickTime Player"
    set saveable of movie 1 to false
    -- save self contained
    end tell
    I would love to be able to do this on a batch level in automator however I cannot figure out how to pass automator items to the apple script so that their saveable can be set to false, and after this I cannot figure out how to have to movies re-saved so the changes will take effect.
    Any help at all would be greatly appreciated.

    how are you passing files to apple script? as finder items?
    the following should work then
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #ADD8E6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    on run {input, parameters}
    tell application "Finder"
    repeat with cur_file in input
    set fname to (name of (get info for cur_file) as text)
    tell application "QuickTime Player"
    open file (cur_file as text)
    set saveable of document 1 to false
    tell application "Finder" to set new_item to (path to desktop as string) & fname
    save self contained document 1 in new_item
    delay 1
    close document 1
    end tell
    end repeat
    end tell
    end run
    </pre>
    the above will dump the modified files onto your desktop and give them the same names they had before. You can adjust that as you like of course.

  • Un Anchoring objects in Indesign CS2 Using Apple script

    Hi all,
    I need to Un achor the object. I have the script which will un anchor the Text Frames but in case of
    Rectangle i'm not able to unachor. My script will find out the Anchrored Text Frames and place its
    contents to its position and then delete the frames. I can find out the Anchored Rectangles but i
    cannot get its contents. Can anyone help me out to do this?
    Thanks,
    Jacintha

    Hi,
    I can select the page item ,If i ask for page items and its parent. but not getting its contents.
    -- aframe is text frames in document
    set Conts to paragraphs of page item i of aframe
    set contents of first insertion point of parent of page item i to Conts
    I need to get the contents of anchoring objects and place it in its position and then delete the anchoring object. Tried working on above code but not able to get its contents. Any solution?

Maybe you are looking for

  • ITunes 11.0.2.26 for Windows

    I have iTunes 11.0.2.26 installed on my Windows laptop. It now displays as larger than the screen, with no scroll bars accessible except for maybe a half width vertical bar when I toggle the minimize/restore button at the top right. The application i

  • How to setup e-mail account without deleting web mail server

    When I delete e-mail on i-phone, it delete web mail server mail also.     I like to keep these web mail server mail. Like old i-phone 4 was not delete web mail server mail, even I delete i-phone mail. Please tell me how to set up e-mail on i-phone. T

  • Can anyone tell me how i get itunes uk on my ipad as i have the american version.

    i have brought an ipad 2 .  i wanted to download some music but it says i am on the american store and i cannot download . i do not know what to do now can any kind person out there give me some advise please .

  • Mail send error in Oracle UCM Test Mail/Notifications

    Hi Everyboby, I have configured workflows which need approval. While the documenr is checked in the notification should be fired to the reviewer. But the mail notification is not working. Also I have tried to login as sysadmin and tried the Administr

  • Mobile Design in Business Catalyst

    Is there any tutorials and/or videos that teaches us how to make a mobile version of a business catalyst site??