Hmm…in general I would steer clear of scripting bridge when equivalent
functionality is available elsewhere. In this case, you can make use of the
Quartz Event Services. There's a Stack Overflow answer here that should be able
to get you started:
http://stackoverflow.com/questions/1938509/how-to-simulate-a-low-level-keypress-on-os-x
As for the exact problem you're facing, I'm not sure what the answer is.
Looking at the AppleScript dictionary, it seems like "command down" and "option
down" are special properties in the dictionary, but I don't recall at the
moment how to extract dictionary properties from the library. Depending on
where you extracted those numeric values from, there's a chance that they could
be different on your system (i.e. enums might change between OS versions, since
you're supposed to use them as enums and not numeric values).
But the short answer is: your code looks fine, and using enums/numeric
constants like that should work as expected in MacRuby. Have you tried the
equivalent code in Obj-C to see if this is specific to MacRuby?
Cheers,
Josh
On Tuesday, May 1, 2012 at 11:57 PM, Josh Voigts wrote:
> Is there a way to get multiple enumerations to work, like in the
> following example. I know I could be doing this with cocoa, but it's a
> small scripting project. (Also I didn't feel like loading a bridge
> support file, would that help in this case?)
>
>
> framework 'ScriptingBridge'
>
> sys = SBApplication.applicationWithBundleIdentifier("com.apple.systemevents")
>
> COMMAND_KEY = 1264807268
> OPTION_KEY = 1265594484
>
> sys.keystroke("u", using: COMMAND_KEY|OPTION_KEY)
>
>
>
> It seems to only recognize the first enum... I'm probably missing
> something logically here...
> _______________________________________________
> MacRuby-devel mailing list
> [email protected] (mailto:[email protected])
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel