MACSCRPT Archives

June 2010

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Nobumi Iyanaga <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Sun, 6 Jun 2010 12:37:47 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (58 lines)
Hello Larry,

Thanks for your reply.

On Jun 6, 2010, at 11:37 AM, Larry McMunn wrote:

> On Jun 5, 2010, at 10:00 PM, Nobumi Iyanaga wrote:
>> MS Word: how to save a doc file as rtf file in the SAME folder?
>
> Try this:
>
> set AppleScript's text item delimiters to {""}
> tell application "Microsoft Word"
> 	set thePath to full name of active document
> 	tell me
> 		set oldTIDs to text item delimiters of AppleScript
> 		set AppleScript's text item delimiters to {"."}
> 		set newDocPath to text items 1 thru -2 of thePath & "rtf" as string
> 		set AppleScript's text item delimiters to oldTIDs
> 	end tell
> 	save document 1 in newDocPath as format rtf	
> end tell

I tried this. Very curiously, this seems to do nothing at all...

But using your code as a hint, I tried this:

set fpath to "Macintosh HD:Users:[me]:Documents:mywork.doc"

set AppleScript's text item delimiters to {""}
tell application "Microsoft Word"
	activate
	open fpath
	set thePath to full name of active document
	tell me
		set oldTIDs to text item delimiters of AppleScript
		set AppleScript's text item delimiters to {"."}
		set newDocPath to text items 1 thru -2 of thePath & "rtf" as string
		set AppleScript's text item delimiters to oldTIDs
	end tell
	tell document 1
		save as file name (newDocPath) file format format rtf
		close
	end tell
end tell

And this time, it seems to work well. Although I still don't  
understand the reason why some code works, and some others don't, I  
think my problem is solved.

Thank you VERY MUCH!

Best regard,

Nobumi Iyanaga
Tokyo,
Japan

ATOM RSS1 RSS2