> > As for actually sending emails, if you want to have things go through > Apple Mail you could use the ScriptingBridge framework which has a few > tutorials online (but for iTunes): > > > http://arstechnica.com/apple/2011/09/tutorial-os-x-automation-with-macruby-and-the-scripting-bridge/ > > AXElements is another option that I am biased in favour of; but it may not > be passive enough for your requirements.
This is really what I want. I need mac mail to send the email at a specific time. Going to research what you provided. Thanks again. On Sat, Oct 20, 2012 at 1:51 PM, Cliff Rosson <cliff.ros...@gmail.com>wrote: > Hi Mark, > > I wouldn't actually loop for an hour I was just lazily writing something > as an example in chat. I'll take a look at what you provided and try to > post my updates here. Thanks so much! :) > > -Cliff > > > On Sat, Oct 20, 2012 at 11:50 AM, Colin Thomas-Arnold > <coli...@gmail.com>wrote: > >> A timer would work fine here I think, but in my opinion there is a lot of >> value in learning GCD - but I also use NSTimers all the time, so whatever >> floats the boat. >> >> But the original code Cliff sent doesn't use a Timer, it assigns a time >> in the future and checks as often as possible that it is equal to "now", so >> effectively blocks until the time has elapsed. Though, if the program >> "goes away" for that second duration, it will never be true. Unlikely, for >> sure, and this code would be fine for a quick command-line program, but not >> good design. A ton a ton of ticks are being wasted implementing a hacky >> version of a timer. >> >> Timers/async == good, loops that block and are effectively a timer == not >> so good. >> >> >> @colinta >> colinta.com >> github.com/colinta >> >> >> >> >> On Oct 20, 2012, at 12:40 PM, Robert Carl Rice wrote: >> >> > Hi Mark, >> > >> > I use NSTimer a lot in my apps. What is the advantage of using GCD API? >> > >> > There is an excellent tutorial on the web for specifically for setting >> up ScriptingBridge for Apple Mail but I forget where I saw it. On warning; >> if you set up ScriptingBridge for Apple Mail don't try to take a snapshot >> in Xcode 4. Xcode will follow the link to mail and include all of your >> mailboxes in the snapshot. I don't know if there is a way to stop this >> behavior. >> > >> > Bob Rice >> > >> > On Oct 19, 2012, at 6:50 PM, Mark Rada <mr...@marketcircle.com> wrote: >> > >> >> Busy looping for an hour would be really bad. I assume you would have >> a sleep in there, but then you're still polling. >> >> >> >> If you are using MacRuby, looking at the GCD API would be a good idea. >> You could do something like this: >> >> >> >> def schedule_email q >> >> q.after(3600) do >> >> # Send email >> >> schedule_email q >> >> end >> >> end >> >> >> >> schedule_email Dispatch::Queue.new("com.rosson.delayed.email") >> >> >> >> NSRunLoop.currentRunLoop.run >> >> >> >> >> >> >> >> As for actually sending emails, if you want to have things go through >> Apple Mail you could use the ScriptingBridge framework which has a few >> tutorials online (but for iTunes): >> >> >> >> >> http://arstechnica.com/apple/2011/09/tutorial-os-x-automation-with-macruby-and-the-scripting-bridge/ >> >> >> >> AXElements is another option that I am biased in favour of; but it may >> not be passive enough for your requirements. >> >> >> >> HTH, >> >> Mark >> >> >> >> >> >> On 2012-10-19, at 6:12 PM, Cliff Rosson <cliff.ros...@gmail.com> >> wrote: >> >> >> >>> Hi Everyone, >> >>> >> >>> I am fairly new to macruby and am having trouble finding some basic >> documentation to help me out. I would like to write a simple app that sends >> a delayed email based on Time from mac mail. >> >>> >> >>> I am thinking of something like this, >> >>> >> >>> time = Time.now + 3600 >> >>> while true >> >>> case time >> >>> when Time.now >> >>> #Send email >> >>> end >> >>> end >> >>> >> >>> Being able to respond to certain emails or send an email from a draft >> would be a huge benefit. Can anyone point me in the write direction to >> accomplish this? I am decently proficient in ruby but don't know where to >> start with MacRuby. >> >>> >> >>> Thanks everyone >> >>> >> >>> _______________________________________________ >> >>> MacRuby-devel mailing list >> >>> MacRuby-devel@lists.macosforge.org >> >>> http://lists.macosforge.org/mailman/listinfo/macruby-devel >> >> >> >> _______________________________________________ >> >> MacRuby-devel mailing list >> >> MacRuby-devel@lists.macosforge.org >> >> http://lists.macosforge.org/mailman/listinfo/macruby-devel >> >> >> > >> > _______________________________________________ >> > MacRuby-devel mailing list >> > MacRuby-devel@lists.macosforge.org >> > http://lists.macosforge.org/mailman/listinfo/macruby-devel >> >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> http://lists.macosforge.org/mailman/listinfo/macruby-devel >> > > > > -- > http://about.me/cliffrosson > vizualize.me/cliffrosson > -- http://about.me/cliffrosson vizualize.me/cliffrosson
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/macruby-devel