On Jun 6, 2010, at 2:05 AM, John Delacour wrote: > 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 John, I believe that with 10.6 (or 10.5, I am not sure, someone might clarify that) Unicode text=text=string so x as string is as good as x as Unicode text. Deivy Petrescu [log in to unmask]