I've been playing around with that, and your script like a great start. I wanted to add an automated turncounter, so I came up with this kludge that built upon your ideas.
Start with a file selection Automator action which specifies a text file which records the turn number, and feed that into the following applescript, you can read the turn number into a variable in Automator and increment it:
Quote:
property theAttachmentPath : (path to "desk") as string
on run {input, parameters}
set mailrecipient to "player@email.com"
set gameattachmentpath to "/Users/youraccount/dominions/savedgames/gamename/early_vanheim.trn"
set mailsubject to "Dominions 3 Game: Turn #" -- turn number will be appended automatically here
set mailcontent to "Here is your most recent game turn. Please save this to your dominions3>test2 directory." & return & return
set theAttachmentPath of me to (item 1 of input as string)
set p to POSIX path of theAttachmentPath
set theFile to POSIX file p
set turnnumber to do shell script "cat " & p
set turnnumber to (turnnumber + 1)
do shell script "echo '" & turnnumber & "' > " & p
set fileAttachThis to POSIX path of gameattachmentpath
set mailsubject to mailsubject & " " & turnnumber
tell application "Mail"
activate
set this_message to make new outgoing message at end of outgoing messages with properties {visible:false}
tell this_message
make new to recipient at end of to recipients with properties {address:mailrecipient}
set the subject to mailsubject
set the content to mailcontent
make new attachment with properties {file name eattachmentpath} at after the last word of the last paragraph
end tell
send this_message
end tell
HideMe()
end run
on HideMe()
tell application "System Events"
set visible of process "Mail" to false
end tell
end HideMe
|
As far as I know, Automator will not allow multiple inputs into an action (I'm an Automator noob, I could be wrong), so unfortunately the filename for the turn incrementer file and other variables have to be set inside the applescript as opposed to feeding nicely into a Send Mail action.