tylergaw / js-osx-app-examples Goto Github PK
View Code? Open in Web Editor NEWExample OS X applications written in JavaScript.
Home Page: https://tylergaw.com/articles/building-osx-apps-with-js
Example OS X applications written in JavaScript.
Home Page: https://tylergaw.com/articles/building-osx-apps-with-js
your examples very awesome
how can i get NSMatrix selected item... Item.tag or item.index for example
They all get
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSGetSizeAndAlignment(): unsupported type encoding spec 'G' at 'GPoint}"size"{CGSize}}' in '{CGPoint}"size"{CGSize}}''
Which seems to happen before many
Wondering:
a) can others replicate this?
b) ideas on the best way forward? Looks like Apple broke it, but was it intentional? How might we make them aware this was really useful.
This is a simple input method performing ROT13 on the English output: https://github.com/jakwings/FooIME
Hi, thanks for your work on documenting how to build JavaScript for Automation apps. Your blogpost and examples are by far the best resources I've found so far.
I'm wondering if you know of any way to bind to keystroke events using JS for Automation? Ideally I'd like to respond to global keyboard events (ie. when the app is not focused), but I'm not sure if that's possible. Through searching around, it seems like an old Carbon API called RegisterEventHotKey
is the way most OS X apps do this. It looks like you can import and use these APIs, my WIP attempt looks something like:
ObjC.import("Cocoa")
ObjC.import("Carbon")
var hotkeyHandler = function(evt) { $.NSLog('hello from handler') }
var evtType = { eventClass: $.kEventClassKeyboard, eventKind: $.kEventHotKeyPressed }
var keyCodeForV = 9
$.InstallEventHandler($.GetApplicationEventTarget(), hotkeyHandler, 1, evtType, {}, null)
s = $.RegisterEventHotKey(keyCodeForV, ($.controlKey | $.cmdKey), {id: 1, signature: 'asdf'}, $.GetApplicationEventTarget(), 0, {});
This doesn't work, but running each of the Carbon functions/variables through console.log shows that they are available and ready to use. The arguments that are empty object literals are the ones I'm unclear about.
The following links look useful for figuring this out, and looking at the Carbon header file at /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h
has also been helpful:
http://stackoverflow.com/questions/8201338/how-to-implement-shortcut-key-input-in-mac-cocoa-app
http://dbachrach.com/blog/2005/11/program-global-hotkeys-in-cocoa-easily/
http://snippets.aktagon.com/snippets/361-registering-global-hot-keys-with-cocoa-and-objective-c
Not sure if an issue is the best way to ask this, but thought it might be useful to others as well if it was documented here. Any pointers or tips would be appreciated!
He Tyler,
Thanks for the examples. I was working on using a WebView but unfortunately I stumbled upon the same problem as described in https://github.com/tylergaw/js-osx-app-examples/blob/master/docs/webview-not-rendering-html.md
I was wondering whether there was any news / response regarding this issue #crossingfingers
Greets,
Paul.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.