Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Steve Clarke
Hi Cliff, I struggled with this too. I'm afraid I can't remember all the details, but I think that one key point is that you need to have an "outgoing message" to respond to send. You may need to add your draft message to the mail apps "outgoing messages" before it can be sent. Try something

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Steve Clarke
Just had a closer look at what I did with sending mail and I think my earlier reply was probably wrong, or at least not helpful. I think the difficulty arises because there are some things that ScriptingBridge is unable to do. I could not find a way to create an outgoing message with Scriptin

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Mark Rada
Hi Cliff, Did you manage to find the SBSendEmail sample code: https://developer.apple.com/library/mac/#samplecode/SBSendEmail/Introduction/Intro.html The sample they have looks a bit different from what you have. I haven't tried it out myself, but their documentation seems quite thorough and wa

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Steve Clarke
Hi, I got something similar working for a plain text email but there are additional requirements for HTML emails (which I needed), and I couldn't persuade SB to accept html content. I should have made that clear in my previous note. If anyone has an example for HTML email with SB it would be

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Cliff Rosson
Steve how did you get it working with the plain text. Below is the code I think that is relevant in the SBS program. - (IBAction)sendEmailMessage:(id)sender { > /* create a Scripting Bridge object for talking to the Mail application */ > MailApplication *mail = [SBApplication applicationWithBundle

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Steve Clarke
Hi Cliff, I guess the answer may be that I didn't get it working in Macruby, as I ended up coding the relevant bit in Objective C! My recollection was that I used Objective C so that I could write a framework that could be used from the system ruby rather than just macruby. Maybe I also ended

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Steve Clarke
Hi Cliff, I've got something simple to work in Macruby. I think the problems I had were because of html content. Here's an example for plain text: = framework 'Foundation' framework 'ScriptingBridge' TITLE="title" def make_message app=SBApplication.applicationWithBundle

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Cliff Rosson
Perfect! How did you figure all of this out. Are there some documents that explain when it is appropriate to use things like "classForScriptingClass" etc...? On Tue, Oct 23, 2012 at 9:49 AM, Steve Clarke wrote: > Hi Cliff, > > I've got something simple to work in Macruby. I think the problems I

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Steve Clarke
You need to use the ScriptingBridge documentation in Xcode - which means that you need to spend some time understanding Objective C. I don't know it well but enough to translate examples into Macruby. I found Matt Aimonetti's book very helpful when I was starting off. It doesn't say a lot abou

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Cliff Rosson
Yea putsing methods(true,true).sort is pretty useful. Below is what I have compiled so far. framework "ScriptingBridge" > @mail = SBApplication.applicationWithBundleIdentifier("com.apple.mail") > @my_account = @mail.accounts.select { |account| account.name == > "MyAccount" }.first > @drafts_fold

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Steve Clarke
Re A) I think it should be easy to transfer the content from draft to outgoing message. Don't both use MailRichText? B) I think you'll be stuck with that problem. As far as I can see you can't mutate an existing message into an outgoing message. Steve On 23 Oct 2012, at 19:05, Cliff Rosson

Re: [MacRuby-devel] Basic delayed email method

2012-10-23 Thread Cliff Rosson
With Steve's help I think I have a working solution. Basically I'll run a macruby script as a cron job which checks my drafts folder every 15 minutes. time_range = ((Time.now - 150)..(Time.now + 300) #I am not sure how much lag I can expect from the job. I would assume it will do its work in only