Selecting "Windows" file link in Mail and then issuing SMB mount

Hi,

I’m trying to write my first Applescript to take an Windows type file link, i.e. \server\folder1\folder2\office_file.ppt or similar and convert to SMB format (Samba) and have the Finder mount and open the file in one of the Office 2008 MAC applications. I work at an company with an Windows network and most employees use Outlook and Windows PCs, so this would be an very useful script. I have read most of the book - AppleScript 1-2-3, but haven’t been able to get past extracting only the file link string from the clipboard.

My basic approach is to assume the user will select the Windows file link contained within the Mail message, then run the Applescript. I’m able to copy the link to the Clipboard, as follows:

tell application “Mail”
activate
tell application “System Events”
tell process “Mail”
keystroke “c” using {command down}
end tell
end tell
end tell

I now need to get only the text string out of the Clipboard. I have tried the following:

try
set the clipboard to Unicode text of (the clipboard as record)
on error errMsg
display dialog errMsg
end try
set file_link to (the clipboard)

I have also tried "set the clipboard to string text of (the clipboard as record).

Both work some of the time, but not always. Offer I get the error “Can’t get unicode text…”

If I get pass this hurdle, then will need to manipulate the string into SMB format, then have the Finder mount…

Thank in advance for any help.

Bill in Seattle

This will get you the text of a message from Mail without using the clipboard. You may have to change the name of the mailbox or account to suit your needs.

tell application "Mail"
	tell message 1 of mailbox "INBOX" of account "Yahoo"
		set myText to content
	end tell
end tell

myText

Thanks, but I would prefer to get only the selected text from the mail message. Otherwise I have to parse the whole message text to determine what the Window file links are.