Re: MS Word - Delete all hyper links
Re: MS Word - Delete all hyper links
- Subject: Re: MS Word - Delete all hyper links
- From: Bryan Vines <email@hidden>
- Date: Thu, 21 May 2009 09:26:36 -0500
On May 20, 2009, at 2:01 PM, email@hidden
wrote:
Date: Wed, 20 May 2009 10:30:37 +0530
From: Satyam Satyanarayana <email@hidden>
Subject: MS Word - Delete all hyper links
Hi,
I have a MS Word rtf document.
It has some images which are not being shown.
When I go to "Preferences"->View->Field Codes, I am able to see the
paths of the image where they are available.
The hyper link is some thing like
{HYPERLINK "file:///Library/Dictionaries/New Oxford American
Dictionary.dictionary/Contents/Images/abacus.png"
Using "inline picutre" script command, I am able to place the image
in my document.
Now, I want to delete this hyper link. How can I do it.
Also has anyone have any idea about turning on/off field codes from
apple script?
--Satyam.
Satyam,
Four years ago, I wrote the script below. I don't recall if it was for
Word X or Word 2004. If nothing else you can use it as a starting
point. Happy scripting!
(*
Remove All HyperLinks
©2005 Bryan K. Vines
Version 1.0
February 23, 2005
This version of the script is designed to be run within Microsoft
Word, via the Script Menu on the menu bar.
*)
tell application "Microsoft Word"
-- Bring Word to the foreground
activate
-- Get a reference to the active document
set myDocument to active document
-- If the reference is valid, we have a document. If not, tell the
user no document was available.
if myDocument is not missing value then
-- Get the name of the currently open document
set nameOfDocument to name of myDocument
-- Ask the user to be patient, this may take a while.
display dialog "It may take a few moments to remove hyperlinks from
“" & nameOfDocument & "”." & return & return & "A message will alert
you when the process is finished." buttons {"Cancel", "OK"} default
button "OK" with icon note
-- Get a list of HyperLink objects
set listOfLinks to hyperlink objects of myDocument
-- Step through list of HyperLink objects, deleting each one
repeat with currentLink in listOfLinks
delete currentLink
end repeat
-- Let the user know the script has finished.
set numberOfLinks to count of items of listOfLinks
if numberOfLinks is 0 then
set theMessage to "Done!" & return & return & "No hyperlinks were
present in the document “" & nameOfDocument & "”. There was nothing to
remove."
else
set theMessage to "Done!" & return & return & (numberOfLinks as
text) & " hyperlinks have been removed from the document “" &
nameOfDocument & "”." & return & return & "Please remember to save the
document."
end if
beep
display dialog theMessage buttons {"OK"} default button "OK" with
icon note
else
display dialog "There was no open document to process." buttons
{"OK"} default button "OK" with icon stop
end if
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden