Applescript: Tuning comment' content in MS Word

Hello,
I am trying to add comments into MS Word document with Applescript.
I can inser tcomment itself with deriverd from this forum sentence:
make new Word comment at selection with properties {comment text:"review this"}
Then I need to change color of text in this comment. The obvious way is to get reference to this freshly created comment, extract
get comment text property as text object and set up font properties to that object.
But I cannot figure how to get reference to this comment. I tried:
          set anchor to make new Word comment at selection with properties {comment text:"review this"}
and anchor is set to:
Word comment 1 of text range id «data iWrg1E0300001E030000» of document "Документ2"
but i got:
get properties of anchor
  --> missing value
Then I tried:
set curText to get properties of selection
but it returns no mention of the Word Comment element :-(
  get properties of selection
  --> {class:selection object, content:"T", formatted text:formatted text of selection, selection start:807, selection end:807, font object:font object of selection, selection type:selection ip, story type:main text story, style:Word style "Обычный" of selection, footnote options:footnote options of selection, endnote options:endnote options of selection, show Word comments by:"All Reviewers", border options:border options of selection, shading:shading of selection, paragraph format:paragraph format of selection, page setup:page setup of selection, show hidden bookmarks:false, story length:888, language ID:russian, language ID east asian:russian, supplemental language ID:russian, column options:missing value, row options:missing value, header footer object:missing value, is end of row mark:false, bookmark id:0, previous bookmark id:0, find object:find id «data iWio68E00A7C» of selection, text object:text object of selection, selection flags:selection active and replace, active:true, start is active:false, IP at end of line:false, extend mode:false, column select mode:false, orientation:text orientation horizontal, document:document of selection, no proofing:false, fit text width:0.0, range footnote options:range footnote options of selection, range endnote options:range endnote options of selection}
At the same time:
  get every Word comment of document "Документ2"
  --> {Word comment 1 of document "Документ2"}
My question is - how to get reference to the Word Comment object created in my Applescript? I cannot use list with all comments (last fragment) because I don't know where exctly my last command is in this list. I cannot distinguish it by texts, because several comments can contain the same "words" but should be of different colors.
Regards,
Vladimir

Sometimes we need just to make break and look for an alternative solution
Below is solution, which is working. I understand, that this not a straightforward solution, but... it works.
tell application "Microsoft Word"
        -- Initially we set up sensless text to
        set tempString to "QWQWWQQ"
        -- create new comment with predefined comment text
       make new Word comment at selection with properties {comment text:tempString}
       -- get list of all comments in current (active) document
       set curComment to Word comments of active document
       -- search for document, we entered last
       repeat with oComment in curComment
           set insertedText to comment text of oComment
           if (content of insertedText is equal to tempString) then
           -- set color for comment
                    set fontColor to ({31270, 38327, 65535} as RGB color)
                   set textik to text object of insertedText
                   set myFont to font object of insertedText
                   -- replace comment's color with custom color
                   set color of myFont to fontColor
                   -- replace "search key" for the actual comment
                   set content of insertedText to "Insert comment text here!!!"
                  exit repeat
           end if
       end repeat
end tell

Similar Messages

  • Using PowerShell to Copy the content of a Word Document and Paste that content into a New Message in Outlook

    So, I'm a little new to PowerShell and I came across a PowerShell which allow me to copy the content od a spreadsheet, into the new message in Outlook 2007.  I have search and search on a way to do the same with a Word Document.  I would like to
    create a PowerShell Script that copies the content of a Word Document and paste that content in an email message.
    I am basing my script on this
    #Create and get my Word Obj
    $w1 = New-Object  -comobject Word.Application
    $w1.Visible = $True
    $UserWord = $w1.Workbooks.Open("C:\Users\hhhh\Documents\Powershell\test.docx")
    #create outlook Object
    $Outlook = New-Object  -comObject  Outlook.Application 
    $Mail = $Outlook.CreateItem(0)
    $Mail.SentOnBehalfOfName = "[email protected]"
    $Mail.Recipients.Add("[email protected]")
    #Add the text part I want to display first
    $Mail.Subject = "Test email"
    $Mail.Body = "My Comment on the Excel Spreadsheet"
    #Then Copy the Word using parameters to format it
    $Mail.Getinspector.WordEditor.Range().PasteExcelTable($true,$false,$false)
    #Then it becomes possible to insert text before
    $wdDoc = $Mail.Getinspector.WordEditor
    $wdRange = $wdDoc.Range()
    $Mail.Display()
    Any Help would be great!

    My requirements are the Word documents are a template of sorts.  The document will be changes prior to its email with some changes.  The other twist is that the customer might more that one recipients, and each recipient will have to have a separate
    email, with the same content of the word document. 
    For example: Say I'm doing maintenance. The Word doc might descript that maintenance, in a set format. Once save the script is run to generate 3 to 10 email with separate recipients with the body of the email containing what was in the Word document.

  • How to read the content of ms-word file use pure java???

    how to read the content of ms-word file use pure java???

    hi,
    check this: http://jakarta.apache.org/poi/

  • Converting Robohelp Content to a Word and PDF document.

    I am in the process of creating an online help manual with several jpg images.  The jpg images are clear in Robohelp, but when I convert the content to a Word or PDF, the content and images are fuzzy and blurry, especially the PDF. Any thoughts or suggestions as to why this is occurring?  I did not have this issue with my last project, the clarity, content, and formatting was very clear including the jpg images.
    Thanks,
    Wendy

    Hi Wendy,
                there is almost no conversion of images on generating any output from RoboHelp, can you please also specify how those topics with images were created.
    if possible please share a sample image and correponding code snippet from RoboHelp.
    you can try removing any resizing done to those images and then generate the output.
    Ashish

  • "Bad comment content" error while building WDJ DC

    Hi folks,
    I am using NWDS 7.0.14 and j2sdk1.4.2_17.
    I created a WDJ DC in NWDS(with no application or component) and tried to build it. But I get error message saying "Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Bad comment content(file:///C:/Documents%20and%20Settings/swapnil/.dtc/LocalDevelopment/DCs/demo.com/test_two/_comp/gen/default/logs/build.xml".
    I uninstalled NWDS, deleted .dtc and .dtr folders and installed it again. But, the error message continues.
    Can you please guide me through this problem??
    Thanks,
    Swapnil.

    Thanks for the clue, Ervin.
    We checked build.xml file and realized that my pc name contains "--".
    "--" marks start/end of comments in XML and that was the reason.
    When we removed one hyphen, the problem was solved.
    Thanks, again.
    Swapnil.

  • FREELIST TUNING(FREELIST의 CONTENTION 확인 방법)

    제품 : ORACLE SERVER
    작성날짜 : 2002-05-15
    Freelist Tuning(Freelist의 contention 확인 방법)
    ==================================================
    PURPOSE
    Freelist Tuning은 Process Freelist 와 Freelist Group의 contention을 최소화하기 위한 것이다.
    Explanation
    1. Freelist의 종류(Bul. 11101)
    : Freelist는 master freelist, process freelist, transaction freelist가 있다.
    (1) Master freelist: Oracle의 내부 메커니즘에 의해 자동으로 생성되며
    모든 process가 access할 수 있고 commit된 transaction에 의해
    transaction freelist의 free block을 포함한다.
    (2) Process freelist: Create시에 storage option에 freelist 설정시 생성되는 freelist로
    process는 자신에게 할당되어 있는 process freelist에 대해서만 사용 가능하다.
    master freelist 와 마찬가지로 committed free blicks을 포함하며,
    동시작업이 많은 환경에서 master freelist의 header의 contention을
    줄이위한 목적으로 사용된다.(8.1.6 이상 부터는 alter command로 freelist 변경이 가능하다.)
    (3) Transaction freelist: 모든 transaction에게 할당되는 freelist로
    하나의 segment에 최소한 16개의 transaction free list가 있으며,
    블럭이 찰 때까지 필요에 따라 증가된다.
    transaction내의 update/delete작업에 의해 free된 블럭을 포함하며,
    current(active) transaction 만이 자신의 freelist를 사용하게 된다.
    transaction이 commit이 되면, transaction freelist에 있던 block은
    master나 process freelist로 옮겨진다.
    2. Process freelist contention
    : Single intance에서 한개의 master freelist만을 사용하게 될 경우
    freelist contention이 발생될 수 있다.
    그러므로 object생성시에 여러개의 process freelist를 사용하도록
    freelist를 설정하게 되면 한 table에 대해 동시에 free block를 찾게 됨으로써
    발생하는 contention을 줄일 수 있다.
    : Freelist를 효과적으로 이용하려면 oracle에 의해
    extent가 자동으로 allocation되는것을 최소화하고
    extent를 object 생성시에 정의를 하는 것이 좋다.
    이유는 table에 자동으로 extent가 할당되는 경우 master pool(common pool)에
    block을 추가하게 되므로 contention을 야기시킬 수 있다.
    3. Freelist group contention
    : OPS환경에서 instance간의 freelist contention을 줄이기 위해 freelist group를
    설정할 수 있다. group의 수는 OPS의 node수와 동일하게 설정하는것이 일반적이다.
    4. Freelist Tuning Parameter
    1) PCTUSED
    2) PCTFREE
    3) Process freelist
    4) Fresslist group
    5. Freelist contention 확인 방법
    : v$waitstat와 v$system_event에서 buffer busy wait event를 찾고
    v$session_wait에서 waiting중인 session의 file#, block# 를 통해
    object name과 freelist 갯수를 알아낸다.
    1) v$waitstat 에서 data block, segment header value가 높고
    v$system_event에서 buffer busy waits 에서 total_wait, total_time이 높으면
    freelist contention 을 의심해 보아야 한다.
    SVRMGR> select * from v$waitstat;
    SVRMGR> select * from v$system_Event;
    2) v$session_wait에서 buffer busy waits 에서
    대기중인 session의 P1(file#), P2(block#), P3(id)를 찾아
    object name과 freelist 갯수를 찾는다.
    SVRMGR> select * from v$session_Wait;
    SVRMGR> select segment_name, segment_type
    from dba_extents
    where file_id=file#
    and block between id and id + block#;
    위에서 확인한 segment_name과 segment_type을 이용하여
    freelist 갯수를 확인한다.
    SVRMGR> select segment_name, freelists
    from dba_segments
    where segment_name=segment
    and segment_type=type;
    3) Freelist tuning
    : Freelist 의 default 갯수는 1이고 적절한 갯수는 동시에 동일한 table(index, cluster...)에
    insert를 할 수 있는 process의 갯수로 지정하는것이 적당하다.
    일반적으로 CPU 수 만큼 설정하면 충분하다.
    6. 그외 event
    (1) select * From v$waitstat; 에서 buffer busy wait 인 class가 data block일 경우
    Solution) pctfree/pctused를 바꾸거나 DB_BLOCK_SIZE를 줄여서 block당 rows수를 줄인다.
    (2) select * From v$waitstat; 에서 class가 segment header일 경우
    Solution) freelists를 사용하시거나 freelists의 수를 늘려준다.
    table이 정기적으로 커지는 경우 너무 작은 extent size는 header에 contention을 일으킬수 있다.
    이럴경우 table의 extent size를 늘려 주시는 것을 고려해 보아야 한다.
    (3) select * From v$waitstat; 에서 class가 undo header일 경우
    Solution) rollback segment당 transaction수를 줄이기 위해서
    rollback segments 를 더 추가한다.
    (4) select * From v$waitstat; 에서 class가 undo block일경우
    Solution) exclusive mode에서 rollback segments를 더 크게 만들어야 한다.
    Reference Ducumment
    Note. 76702.1
    Note. 1029850.6

  • Read content in Microsoft Word file.

    My new project is to read content in Microsoft Word. But,
    blah blah blah code are appeared when I read microsoft word file
    with cffile tag, and display included content in textarea. Here is
    my coding. Anything wrong in my coding and how can I read ms.word
    file and display included content in this file??
    all answers will be appreciated.

    I have figured out how to use Object in Word to embed the SWF file and use the Control Box to activate it, however, like you when I convert to Acrobat PDF from the Word Add-in it does not embed the SWF in a playable format, although the object is there.  I can't seem to get any relevant properties using the Touch Up Object tool either.  I hope someone else has a clue.  Otherwise I recommend creating your word document with "empty" text boxes that the text will wrap around and then converting to PDF and once in Acrobat embed a Flash object using the Multimedia button.

  • How to save automatically the content of the word document on Intranet site

    Hi,
    There is a function asked by application user:
    1. Open Word document from the corporate Intranet site
    2. Update the content of the Word document
    3. Automatically update the Word document on Intranet site with the new content or automatically upload Word document with the new content.
    Thank you for your help or any suggestion.
    Best regards,
    Mladen

    After generating, use F2 to rename the output.
    Sorry but I don't think you can avoid it.
    Please follow this link and submit a feature request.
    http://www.Adobe.com/cfusion/mmform/index.cfm?name=wishform&product=38
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Hidden comments for users of Word 2013, but not earlier versions

    I have a Word document that was probably originally created with Word 2000. We continuously work with this document and have made many changes over the last 15 years. We've made changes to the document using Word 2003, 2007, 2010 and 2013.
    Now, when users of Word 2013 use the document, most of the comments do not appear in balloons. A few of the comments do appear in balloons. Users of earlier versions of Word see all of the comments in balloons. All users can see all comments in the
    reviewing pane.
    Show Markup is set for display of all information. I.e., there are checkmarks by "Comments", "Ink", "Insertions and Deletions", "Formatting", "Balloons/Show Revisions in Balloons", and "Specific People/All
    Reviewers".
    We had been saving the document as a Word 97-2003 Document. I converted it to a "Word Document" and the behavior is the same.
    Thanks.

    Try this in Word 2013: Copy the document content, minus the final paragraph mark, into a new file. Does that make a difference?
    Stefan Blom, Microsoft Word MVP

  • Applescript-Apply Character Style to Select Words in InDesign CC

    I'm trying to apply a character style to the first several words of a paragraph. The number of words varies, but it is essentially every word before a comma.
    Here's what I have so far:
    tell application "Adobe InDesign CC 2014"
      tell document 1
      tell page 2
      tell (item 1 of page items whose label is "HabitsContent")
      tell paragraph 2
      repeat with i from 1 to count of characters
      if contents of character i = "," then
      exit repeat
      end if
      end repeat
      set applied character style of characters 1 thru i to "Italic"
      end tell
      end tell
      end tell
      end tell
    end tell
    Viewing the log of the script, it finds the comma; however, the script ends up italicizing the entire paragraph. Any ideas?

    For anyone else who has a similar question, here's what works:
    tell application "Adobe InDesign CC 2014"
    tell paragraph 2 of (item 1 of page items whose label is "HabitsContent") of page 2 of document 1
    set a to paragraph 1 as list
    set a to text item 1 of a
    set old to AppleScript's text item delimiters
    set AppleScript's text item delimiters to {","}
    set font style of characters 1 thru (count of text item 1 of a) to "Italic"
    set AppleScript's text item delimiters to old
    end tell
    end tell

  • Report Generation Toolkit: Table of Contents in MS Word

    Hello forum users,
    I would like to add a table of contents to a MS Word document, using the Report Generation Toolkit.
    I couldn't find a VI in the toolkit that does that, so I tried to modify the VI "Word Insert Field.vi". Doing so, I could access a property node of the class "Word._Document"  and an invoke node of the class "Word.TablesOfContents" with the method "Add".
    As this modified VI does not belong to the private LabVIEW class "NI_Word.lvclass", it is not possible to unbundle the (type cast) "report in" wire to get the "Word._Document" class reference. I can't add the modified VI to the NI_Word class either, because it is password protected.
    There are so many methods and properties that are not used in the official Report Generation Toolkit, like this one. How can I access them?
    Or maybe there is another way to add a table of contents to a MS Word document (programmatically). Maybe I have to use a template. I rather wouldn't, though.
    Operating System: Windows 7 64bit
    LabVIEW: 2009 [9.0 (32bit)]
    Report Generation Toolkit: 2009
    MS Office: 2003 SP1
    Thank you for reading an answering.
    Solved!
    Go to Solution.
    Attachments:
    Word_Insert_TOC.png ‏68 KB

    Hello again,
    in the "Word Specific" > "Word Advanced" Palette of the Report Generation Toolkit, there is a VI called "Word Get ActiveX References" which essentially unbundles the private "report" data stream / wire. Thus, I can use the property and invoke nodes that make use of the "Add TablesOfContents" method.
    I hope, that helps other users as I didn't find too many topics on Report Generation. Maybe it's just too easy...
    Attachments:
    Word_Insert_TOC_fix.png ‏60 KB

  • How to show content from microsoft word and pdf on a page

    Hi,
    I have a microsoft word file stored in content repository and I want to show it in web page. When I drag and drop it using content presenter it shows file as a link with some extra details like created by, last modified by etc. I want content to appear in UI page itself. Content of document should get converted to html at runtime and then appear in UI. Is it possible?
    Thanks
    Sanjeev

    Sanjeev,
    I see you have as similar requirement you posted in the thread here :
    Skipping ucm login form when showing content on webcenter application.
    InBound Refinery (IBR) would be the easiest way to accomplish this though.
    Once you have IBR installed and configured (you need to pick what formats need to be converted in the refinery, and in your case, choose MS Office formats),
    You can use the document viewer taskflow to render PDF versions of your Word/Excel or PDF documents on a webcenter page. There is little to no setup required for this, beyond configuring IBR (but configuring IBR is fairly involved) and selecting what MIME types you want IBR to process.
    Another thing to watch out for if you are using Spaces is, make sure you set the context root for UCM properly though EnterpriseManger.
    Dynamic Converter can also be used to get similar results. You mention that you are using an Iframe, that means the client is making a request to UCM directly, and to avoid re-authenticating there, you should have SSO enabled. With Dynamic converter, you can use a URL of the form :
    http:// +<host>:<port>+ / +<context_root>+ /idcplg?IdcService=GET_DYNAMIC_CONVERSION&dDocName= +<docID>+ &RevisionSelectionMethod=LatestReleased
    To get an HTML rendition of that document.
    Hope it helps !
    -Jeevan
    Edited by: Jeevan Joseph on May 14, 2012 3:07 PM
    Edited by: Jeevan Joseph on May 14, 2012 3:08 PM

  • Open xml relationship target is NULL when inserting chart into a mapped rich text content control in Word 2013

    Hi,
    I have a word document with a rich text content control that is mapped to a CustomXml. You can download an example here
    http://1drv.ms/1raxoUr
    I have looked into the specification ISO/IEC 29500-1:2012 and i understand that the attribute Target for the element Relationship can be set to NULL at times(Empty header and footer in the specification).
    Now, i have stumbled on Target being NULL also when inserting a diagram into a word document. For example:
    <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
    Target="NULL" TargetMode="External" xmlns="http://schemas.openxmlformats.org/package/2006/relationships" />
    Why is Target="NULL" and how should i interpret that Target is null?
    Br,
    /Peter
    Peter

    Hello Peter,
    The relationship in question is associated with the externalData element (ISO/IEC 29500-1:2012 §21.2.2.63). For the other two charts in this document, the corresponding relationships are of the other allowable form:
      <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/package" Target="../embeddings/Microsoft_Excel_Worksheet1.xlsx"/>  <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/package" Target="../embeddings/Microsoft_Excel_Worksheet2.xlsx"/>
    For charts 1 and 3 in your document, the data can be edited via the Chart Tools ribbon control. The option to edit data is not available for chart 2. The data used to create chart 2 is the same default spreadsheet data used for chart 1, and in fact the spreadsheet
    references are still present in the file format, despite there being no apparent link to a spreadsheet for chart 2.
    Thus, it appears that Target="NULL" in this context means that the chart is not associated with an external data source. The specification doesn't have much to say about the semantics of the Target attribute (ISO/IEC 29500-2:2012 §9.3.2.2) beyond
    the fact that it be a valid xsd:anyURI, which the string "NULL" is.
    It looks like there is some unexpected interaction between the chart and the content control. I don't think the file format is the issue. You will probably need to pursue that behavior from the product perspective via a support incident, if that behavior
    is unexpected. If you still have questions about what is seen in the file format, please let me know.
    Best regards,
    Matt Weber | Microsoft Open Specifications Team

  • How to read the content of MS Word document?

    Hello Experts,
    I need to upload ms word document and fetch its content to an internal table.
    Is there any function module or class which is suitable to my requirement?
    Regards
    DNR Varma

    Dear DNR
    Look for class CL_CRM_DOCUMENTS in CRM. You can leverage this class to upload/download any type of document in CRM.
    Thanks
    Vishal

  • Help:how to get content of the word(.doc) attachment in a email

    help to all:
    I get the email attachment(.doc or .xls) and it's
    content,using javaMail Api .but output it on the
    computer screen,I see only some sign unreadable.
    Pls how to get the content.
    thanks for you.
    bi tan

    Save the output to a file and open it in Word/Excel thats what documents attached to mail are made for...
    If you really need the contents send them in the body or in a plain text attachment.

Maybe you are looking for

  • Is it possible to force the implementation of a SAP note?

    Hi guys, I am installing SAP CPM, software components CPD 1.0 and PICM 1.0.  During the SAINT installation, I hit an error for both components in the ABAP Generation Phase.  I have found two notes with automatic corrections (1843317 and 2040519) to f

  • Problem with autofill in Mountain Lion Mail

    Autofill in the addresses field not working. If I start typing I get the spinning circle on the right but it fails to pull up anything. Also if you open Addresses in mail its empty. The actual address book app appears to be fine.  Does anyone have an

  • Call Manager 4.1 web display problem

    Hi, does anyone know how to troubleshooting this kind problem? Call Manager 4.1 web interface does not display results for the Global Directory or Phone listing to add, delete or modify an acct. The screen does not response any key entry, but it disp

  • Meta tag question(s)

    I am curious about a meta tag I came across: <meta name="description" content=" "> <meta name="keywords" content=" "> <meta name="revisit-after" content="31 days"> <meta name="robots" content="all"> <meta name="url" content=" http://www.cariholdorf4h

  • A virus-like program MY HERITAGE SEARCH stopped me from using Firefox. How do I get rid of Heritage?

    I used Firefox works well on my old Sony computer. It was working well on my new HP until this program called MY HERITAGE SEARCH appeared and blocked the entire Firefox browser on my monitor. Eventuallly, I had to remove it from my computer. I am now