40Tech
40Tech
BBEdit to MarsEdit (AppleScript) 40tech.com
|
Embed
smokey
smokey

@40Tech Nice work there :-) There’s not so much extra code as doing everything a long way, which is totally normal when getting started with AppleScript. Neat to see that MarsEdit can just read files on disk into post bodies, too…

Here’s a version that uses a different (and in my mind, more AppleScript-y) approach (with the caveat I don’t have MarsEdit, so I can’t vouch for whether its make new document command works as “normal” in AppleScript, but you could always make the document like you do in your script, then set the body to postText after, using 2 steps, if needed):

on run
tell application "BBEdit" to set postText ¬
to contents of document 1
tell application "MarsEdit" to make new document ¬
with properties {body:postText}
end run

(The ¬ is a continuation character to allow you to hard-wrap long lines without breaking the script, mostly used when you’re going to be posting a script somewhere you don’t have control over line-length and wrapping.)

Er, I guess you still want an activate in there for MarsEdit, too, to bring it to the front in order finish up posting manually. But welcome to the world of AppleScript, and hope this gives you some new avenues to explore :-)

|
Embed
In reply to
40Tech
40Tech

@smokey Thank you! I will give that a try, and see how it works. I know just enough to be dangerous at this point.

|
Embed