adric: books icon (c) 2004 adric.net (Default)
ETA: Z has a workaround that got RubyCocoa going for me in SL: http://zarchanalin.livejournal.com/133451.html

Comment added to: "Having Fun with MacRuby on Snow Leopard" http://www.icoretech.org/2009/08/having-fun-with-macruby/comment-page-1/#comment-56

Hi,

Cool howto! You might want to note that now and for the forseeable future ths will only work on 64bit capable machines. There are a few machines that can install 10.6 and run it just fine, but have no support for 64 bit and cannot build current macruby (as confirmed on the mailing list in Aug), although it is planned to have 32 bit support (back) in the 0.5 release.

If anyone is in doubt, this snippet may assist, run in Terminal:
sysctl hw.cpu64bit_capable

hth,
adric

If anyone is still reading they may be interested to know that "Snow Leopard" 10.6 XCode (3.2) includes support for C, C++, ObjC, and AppleScript only. Other language bindings may work (PyObjC is reportedly okay, from svn) but no others shipped. MacRuby 0.4 install may work some. RubyCocoa is in Ruby but not XCode. Oh and they changed InterfaceBuilder again, and I have yet to figure out how to add Outlets without editing source (.h or .rb) files.
adric: books icon (c) 2004 adric.net (Default)
cat >> fix_economy.rb && ruby -w fix_economy.rb

investment_banks.find_all do |bank| bank.has_requested_federal_bailout_money?
  bank.ceo.set_salary($FEDERAL_MINIMUM_WAGE_SALARY) 
    unless bank.ceo.already_in_prison? or bank.ceo.dead?
  FBI.investigate(bank)
  FBI.investigate(bank.ceo)
end

while Congress.dads_wallet_open?
  set_price(:unleaded_gasoline, 2.00)
  ship_goods_to(:gas, :here)
  sack(:Congress)
end

appraisers.find_all do |liar| liars.committed_fraud?
  FBI.investigate(liar)
end

mortgage_holders.find_all do |signer| signer.lied?
  signer.get_home.foreclose!
  signer.moves_in_with(:mom)
end

government = executive_branch + legislative_branch
government.each do |officeholder|
  sack(officeholder)
end

p 'Problem solved. Please return to economic and political norms.'  
adric: (Mac OS X)

So, I banged around in irb and Google working on this whole automate my Mac's built-in camera thing. I'm not averse to buying one of the neat-o cam applications I found, like EvoCam, which could almost certainly do whatever still or video capture I want, but I want to know what I can do for free and/or with the shipping software image. And although this is a Mac specific project for the most part, the less shareware involved the more likely I am to learn something portable to another platform. From a MacDevCenter thread I was reminded of QuickTime Broadcaster, and fetched new binaries of it from Apple. Checking the FAQ for it about Applescript and then Googling led me straight into the PDF of the Leopard Server manual which says this:

For detailed information on the AppleScript features QuickTime Broadcaster supports, drag the QuickTime Broadcaster icon to the Script Editor icon in /Applications/ AppleScript/.

This seemed a rather odd thing to suggest, but I gave it a go, and it actually worked! Apparently for applications with Applescript (OSA) hooks, this odd gesture opens their dictionaries (API) in Script Editor. I could already get this in html with a tool that the rubyosa gem installs called rbdoc-osa, but I was still amused. It helped confirm my earlier finding that Photo Booth is completely without scripting hooks (fail!). I was able to create a simple little script that starts recording video with the existing setting, and another to stop it. I also ended up futzing more with my rbosa scripts and got them all working and updated.

adric: (Mac OS X)
Check out this: "RubyOSA: The End of AppleScript?" http://www.clarkware.com/cgi/blosxom/2006/10/24#RubyOSA
which links to: "Rake Shame" http://codefluency.com/2006/10/23/rake-shame
and from which I scrawled song.rb:
require '~/Work/rubyosa/osa.bundle'
require '~/Work/rubyosa/rbosa.rb'

itunes = OSA.app('itunes')
track = itunes.current_track

p track.artist + " - " + track.name
With which and a dash of alias song="ruby ~/Work/song.rb" I now have a song command for posting to LJ:
song | pbcopy ... complete with Unicode escapes that no one likes, apparently...
and this with some inevitability leads to:
tunes = OSA.app('itunes')
ducktroller = OSA.app('adium').adium_controller
ducktroller.my_status_message= tunes.current_track.artist + " - " + tunes.current_track.name
.. which I'll shortly thrown in cron..

Profile

adric: books icon (c) 2004 adric.net (Default)
adric

June 2025

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Links

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 1 July 2025 08:36 pm
Powered by Dreamwidth Studios