Mime-Version: |
1.0 |
Content-Type: |
text/plain; charset="macintosh" ; format="flowed" |
Date: |
Sun, 6 Jun 2010 07:05:31 +0100 |
Reply-To: |
|
Subject: |
|
From: |
|
In-Reply-To: |
|
Content-Transfer-Encoding: |
8bit |
Sender: |
|
Parts/Attachments: |
|
|
At 22:37 -0400 5/6/10, 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
First, the pathname should be Unicode text and not string, especially
since Nobumi is likely to create files with unstringy names:
set newDocPath to text items 1 thru -2 of thePath & "rtf" as Unicode text
and second, you can't save to a path-string. It needs, according to
the standard generated dictionaries, to be Ç[in alias] : the file in
which to save the objectÈ, but that wording is wrong and always has
been; for a document that does not exist you save to a
_file_specification_, or POSIX file...
...so the following ought to work:
set _file to (newDocPath as file specification)
save active document in _file as format rtf
...but it doesn't, even if you create the file first, and no error is returned.
I have no solution unfortunately.
JD
|
|
|