View Full Version : Another script for someone to doctor

Mar 25, 2006, 09:38 AM
Reciently I started a thread asking for a script to so something (I will quote the thread). Eraserhead wrote the script (which works wonderfully except it doesn't do the formatting). So if anyone knows how to get this thing to keep the formatting from the clipboard please edit it so it keeps the formatting.

The "quest":
Hello anyone with AppleScript programming knowledge. I just need a quick little script that will take the text from the clipboard, and paste it into a new .rtfd file on the desktop. Two things the script must do are.... 1. Ask "Who is the conversation with?" then give a text box where I type in "Christine" then it will take the text from the clipboard and create a .rtfd file on the desktop called "Chat with Christine" when I click OK, like wise if I put in "Jeff" it would make a file called "Chat with Jeff". The other thing it must do is keep the formatting ie colours and fonts.

--Thanks so much

PS If you decide to be the lucky programmer to take this task please post that you are working on it so I don't get 5 or 6 copies of the same script. Secondly when you are done please email me the file, my email address is my GoogleTalk name.

The script:
set theName to the text returned of (display dialog "Who is the conversion with?" default answer "")
tell application "Finder" to set theClipboard to the clipboard
set thefolder to the path to desktop as string
set theNo to ""
tell application "Finder"
if file (thefolder & "Chat with " & theName & theNo & ".rtfd") exists then
if theNo is "" then
set theNo to 2
set theNo to theNo + 1
end if
exit repeat
end if
end repeat
make new file in folder thefolder with properties {name:("Chat with " & theName & theNo & ".rtfd")}
write theClipboard to file (thefolder & "Chat with " & theName & theNo & ".rtfd")
end tell

EDIT: I think I know how this must be done, it will probably work if you tell the script to create the file through textedit.app

--Thank you for your efforts.