On Jun 5, 2010, at 11:37 PM, Nobumi Iyanaga wrote:
> 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.
Well Nobumi, may be your problem is solved as far as I see it, there is a problem with word.
Using the script you said it was not working , the only difference is you are now manipulating text with AS instead of the shell.
It should make no difference in how the text is read afterwards.
This is a bug for me.
I do not script word, so it does not affect me. But it is certainly something that MS should be aware of.
>
> Thank you VERY MUCH!
>
> Best regard,
>
> Nobumi Iyanaga
> Tokyo,
> Japan
Deivy Petrescu
[log in to unmask]
|