[MacRuby-devel] xcode question
….I am new to mac , macruby , ruby etc I have built an application using XCODE and when I click RUN on XCODE the application runs and does what I intended here to do. But … I don't find the way to run it OUTSIDE of XCODE , like any other app I have on my mac. When I look at the directory of my app , it does not have the structure of my regular applications located in /Applications folder. I tried to find an answer in MAC Developer library but got lost (??) so I apologize if this is too simple a question Many Thanks, David Kramf ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo/macruby-devel
Re: [MacRuby-devel] xcode question
Build it in deploy mode Build > Archive Assuming you have provisioning profiles and your proper codesigning certificates installed from developer.apple.com You can submit it to App Store (if you know how to use iTunes Connect), or export as a Mac Installer or Application If you export as Application it will have the same format as other .apps and can be moved into /Applications. If you export a Mac Installer, it will create a package that will install itself into Applications, this also seems to serve as the update mechanism. Make sure, if you use any gems, under Deployment that you use --gem with macruby_deploy On Wed, Oct 24, 2012 at 10:15 AM, david kramf wrote: > > ….I am new to mac , macruby , ruby etc > I have built an application using XCODE and when I click RUN on XCODE the > application runs and does what I intended here to do. > But … I don't find the way to run it OUTSIDE of XCODE , like any other app I > have on my mac. > When I look at the directory of my app , it does not have the structure of my > regular applications located in /Applications folder. > I tried to find an answer in MAC Developer library but got lost (??) so I > apologize if this is too simple a question > > Many Thanks, > David Kramf > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo/macruby-devel
Re: [MacRuby-devel] xcode question
How do I export it as Application ? Thanks, David On Oct 24, 2012, at 7:24 PM, Jonathan Silverman wrote: > Build it in deploy mode > > Build > Archive > > Assuming you have provisioning profiles and your proper codesigning > certificates installed from developer.apple.com > > You can submit it to App Store (if you know how to use iTunes > Connect), or export as a Mac Installer or Application > > If you export as Application it will have the same format as other > .apps and can be moved into /Applications. If you export a Mac > Installer, it will create a package that will install itself into > Applications, this also seems to serve as the update mechanism. > > Make sure, if you use any gems, under Deployment that you use --gem > with macruby_deploy > > On Wed, Oct 24, 2012 at 10:15 AM, david kramf wrote: >> >> ….I am new to mac , macruby , ruby etc >> I have built an application using XCODE and when I click RUN on XCODE the >> application runs and does what I intended here to do. >> But … I don't find the way to run it OUTSIDE of XCODE , like any other app I >> have on my mac. >> When I look at the directory of my app , it does not have the structure of >> my regular applications located in /Applications folder. >> I tried to find an answer in MAC Developer library but got lost (??) so I >> apologize if this is too simple a question >> >> Many Thanks, >> David Kramf >> ___ >> MacRuby-devel mailing list >> [email protected] >> http://lists.macosforge.org/mailman/listinfo/macruby-devel > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo/macruby-devel
Re: [MacRuby-devel] Basic delayed email method
So here is the lazyman's solution I came up with.
#!/usr/local/bin/macruby
> framework 'ScriptingBridge'
> ACCOUNT = "AccountName"
> DAY = Time.now.day
> MONTH = Time.now.month
> YEAR = Time.now.year
> time_range = ((Time.now - 150)..(Time.now + 300))
> @mail = SBApplication.applicationWithBundleIdentifier("com.apple.mail")
> my_account = @mail.accounts.select { |account| account.name == ACCOUNT
> }.first
> drafts_folder = my_account.mailboxes.select { |mailbox| mailbox.name ==
> "Drafts" }.first
> delayed_messages = drafts_folder.messages.select { |x|
> x.subject.match(/\[SEND@\d\d:\d\d\]/) }
> delayed_messages.each do |draft|
> tag = draft.subject.match(/\[SEND@\d\d:\d\d\]/)[0]
> hour, minute = tag.scan(/\d\d/)
> time = Time.local(YEAR, MONTH, DAY, hour, minute)
> if time_range.cover?(time) && draft.recipients.length > 0
> props = {}
>
> props['subject'] = draft.subject.gsub(tag, '')
> props['sender'] = draft.sender
> props['content'] = draft.content.get
>
> outgoing_msg = @mail.classForScriptingClass('outgoing
> message').alloc.initWithProperties(props)
> @mail.outgoingMessages.addObject(outgoing_msg)
> recievers = ""
> draft.recipients.each do |recip|
> recievers << "%s," % recip.address
> end
> recipient = @mail.classForScriptingClass('to
> recipient').alloc.initWithProperties({'address'=>recievers})
> outgoing_msg.toRecipients.addObject(recipient)
> if outgoing_msg.send
> draft.delete
> end
> end
> end
And this runs in a cron every 15 min. Been using it all day successfully.
Only does plain text because I could not figure out how to migrate the rich
text formatting over.
On Tue, Oct 23, 2012 at 9:42 PM, Cliff Rosson wrote:
> 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 a few seconds but here I have given myself a few
> minutes grace.
>
> I'll create an draft email with the a tag in the subject line. "[SEND@16:15]"
> for example. When the appropriate time comes my script will build an
> outgoing message for each draft with a time tag that matches the present
> time_range. The tag will be removed from the subject and the message will
> be sent. It will then delete the now expired draft message.
>
> What do you guys think about this? This seems like the easiest way to get
> delayed/automated emails configured in Apple Mail without much
> sophistication. There are some limitations that could be fixed, like taking
> date into account.
>
>
> On Tue, Oct 23, 2012 at 11:56 AM, Steve Clarke wrote:
>
>> 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 wrote:
>>
>> 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_folder = @my_account.mailboxes.select { |mailbox| mailbox.name==
>>> "Drafts" }.first
>>> @draft = @drafts_folder.messages.first
>>>
>>
>>
>> def send_message(message)
>>> props = {}
>>>
>>> props['subject'] = message.subject
>>> props['sender'] = message.sender
>>> #props['content'] = message.content
>>>
>>>
>>> outgoing_msg = @mail.classForScriptingClass('outgoing
>>> message').alloc.initWithProperties(props)
>>> @mail.outgoingMessages.addObject(outgoing_msg)
>>> recipient = @mail.classForScriptingClass('to
>>> recipient').alloc.initWithProperties({'address'=>message.recipients.first.address})
>>> outgoing_msg.toRecipients.addObject(recipient)
>>>
>>> outgoing_msg.send
>>>
>>> end
>>> send_message(@draft)
>>
>>
>> *Note I used instance variables so I could play with these objects in
>> macirb. If you were wondering...
>>
>> The code above works. I get the email. Two issues however.
>>
>> A)
>> I can't figure out how to pull the text contents of my @draft.contents
>> message. Presumably because it is a MailRichText class and not a simple
>> string object. If only somehow I could attach this contents to the outgoing
>> message to preserve the body. What would be even better is to simply create
>> my outgoing message with something like InitWithDraft so as to use a
>> drafted email already created. I suspect this will require further research
>> from me.
>>
>> @draft.content
>> => > of MailAccount 0 of application "Mail" (1845)>
>>
>> B)
>> The other issue is since I am not using my existing drafted email
>> creating this
Re: [MacRuby-devel] Quartz 2D Graphics problem
Hi,
I have my app working again after converting my Quartz2D drawing to ObjC. Not
as difficult as I had anticipated and now I've learned some ObjC.
So now some of my classes have three files with extensions .h, .m and .rb. It's
easy to reference the ObjC property accessor methods from MacRuby.
Thanks for the help,
Bob Rice
On Oct 21, 2012, at 3:28 PM, Colin Thomas-Arnold wrote:
> yup, you can't mix and match within one file.
>
>
> @colinta
> colinta.com
> github.com/colinta
>
>
>
>
> On Oct 21, 2012, at 1:22 PM, Robert Carl Rice wrote:
>
>> Hi,
>>
>> Actually, I already have PBSerialPort m & h files by Paolo Bosetti dropped
>> into my project and it works fine. I was wondering is a class could have
>> both Objective C and Ruby code but from this discussion I gather the class
>> must be either MacRuby or ObjC. Is this correct?
>>
>> Thanks,
>> Bob Rice
>>
>>
>> On Oct 21, 2012, at 2:40 PM, Jim Getzen wrote:
>>
>>> You don't need to make a framework or bundle to add Obj-C code to your
>>> project. I've been able to just add a .h/.m files directly to the project
>>> and call the Obj-C classes contained therein from my MacRuby code, just as
>>> if those classes were part of a framework.
>>>
>>> What you can't do, of course, is call straight C functions or constants
>>> without a bridgesupport file.
>>>
>>> Jim
>>>
>>>
>>> On Oct 21, 2012, at 12:59 PM, Mark Rada wrote:
>>>
>>> Adding some Objective-C code could be done with a framework as suggested,
>>> or by creating a bundle. The bundle process is essentially the same as
>>> creating a C extension for Ruby. Any MacRuby project with a C extension
>>> could be used as an example:
>>>
>>> https://github.com/pieter/macruby-bundle-example
>>> https://github.com/Marketcircle/AXElements/tree/master/ext/accessibility/key_coder
>>> https://github.com/alloy/ObjectiveBacon/tree/master/LanguageBindings/MacRuby/ext
>>>
>>> You can then simply "require 'bundle'" the bundle file that is compiled.
>>>
>>>
>>> On 2012-10-21, at 12:44 PM, Colin Thomas-Arnold wrote:
>>>
You can certainly compile a group of stuff as a framework, and add that
framework to your project, but I've never tried to just toss in .h/.m
files and access them from macruby.
Can anyone touch on that? I'm interested to hear what can be done there...
AFA translating your code into Obj-C...
Here's the short version:
self.context = [[NSGraphics currentContext] graphicsPort];
And here's the long version!
// the header file, YourClass.h
@interface YourClass : ParentClass
@property (assign, nonatomic) CGContextRef context;
// or void* instead of CGContextRef, but graphicsPort returns a
CGContextRef
@end
// the implementation file, YourClass.m
#import "YourClass.h"
@implementation YourClass
@synthesize context;
- drawRect:(CGRect)rect
{
self.context = [[NSGraphics currentContext] graphicsPort];
}
@end
@colinta
colinta.com
github.com/colinta
On Oct 21, 2012, at 10:19 AM, Robert Carl Rice wrote:
> Hi Mark,
>
> Unfortunately, I am not very familiar with objective C syntax. Is it easy
> to mix objective C statements with MacRuby?
> For example, How would code the @context =
> NSGraphicsContext.currentContext.graphicsPort in objective C?
>
> Thanks,
> Bob Rice
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
>>>
>>> ___
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>>>
>>> ___
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macruby-devel
