Problem with repeat command
Problem with repeat command
- Subject: Problem with repeat command
- From: "francois.houle" <email@hidden>
- Date: Wed, 26 Oct 2005 14:56:46 -0400
- Thread-topic: Problem with repeat command
I'm writing a script to export mail from Entourage to Word, save the mail in
there as a word doc in a specific location. What I'm not able to do up to
now is to be able to select multiple pieces of mail and have all of them
save and close in word one after the other... I tried to do it but it only
seems to save the last item that's selected. The others, even thou windows
open for them in word and it seems to save them, they appear nowhere on the
computer. Don't have an idea whats wrong since I get absolutely no error
messages when executing the script.
Also, I've included a command to change the path to save to and change the
default back to standard at the end... Is this the best way to do it ?
So here is the script:
tell application "Microsoft Entourage"
set selectedMessages to current messages
if selectedMessages is {} then
display dialog "Please select a message first and then run this
script." with icon 1
return
end if
repeat with theMessage in selectedMessages
set theName to subject of theMessage
set theContent to content of theMessage
end repeat
end tell
tell application "Microsoft Word"
set default file path file path type documents path ¬
path "Macintosh HD:Users:myuser:Documents:Entourage dump"
repeat with theMessage in selectedMessages
set fileName to do shell script "echo '" & theName & "' | tr
'[:punct:]' ' '"
set newDoc to make new document
set name of font object of text object of newDoc to "Times New
Roman"
set oRange to create range active document start 0 end 0
set content of oRange to theContent
set oRange to change end of range oRange by a word item ¬
extend type by selecting
save as newDoc file name fileName
close document theName
end repeat
set default file path file path type documents path ¬
path "MacIntosh HD:Users:myuser:Documents"
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden