philikon / osxtypes Goto Github PK
View Code? Open in Web Editor NEWJavascript bindings for OS X frameworks via js-ctypes
License: Other
Javascript bindings for OS X frameworks via js-ctypes
License: Other
Hi there man this is excellent work. I was wondering if you were available to help a noob at mac os js-ctypes. I'm trying to do the following things:
Aside:
do you know how to create a applescript file and set its icon? Im trying to programatically do this http://weblogs.mozillazine.org/asa/archives/2008/08/shortcut_to_lau.html
I'm in process of trying to get a Mac OS VM setup :)
Hi there,
Your code is just so awesome I have learned so much from it! Thank you so much for such awesome work!!
Please add this example to your collection: https://gist.github.com/Noitidart/03052979069adc80a00c
It shows some basic dictionary reading. In this example I'm trying to get the value kCGSSessionOnConsoleKey
from a dictionary, per this topic here: http://stackoverflow.com/a/11511419/1828637
I did later use it for CGSSessionScreenIsLocked
Hi there philikon,
I'm trying to do this here:
Creating ICNS files can also be done using the old IconFamily API, but it's a bit hairy. Also, it doesn't support high-resolution icons.
First, you create a handle (pointer-to-pointer-to-resizable-buffer) for the icon family:
IconFamilyHandle iconFamily = (IconFamilyHandle)NewHandle(0);
Then, for each image size (16, 32, 128, 256, and 512), you create a handle for a raw bitmap of the image data. The bitmap should be 32 bits per pixel, 8 bits per component, ARGB non-premultiplied data with no padding.
int size = /* 16, 32, 128, 256, or 512 */; Handle handle = NewHandle(size * size * 4); // fill handle with image data; buffer pointer is *handle
Then, you add that handle to the icon family with a call like:
SetIconFamilyData(iconFamily, kIconServices16PixelDataARGB, handle);
For the other sizes, replace the "16" in
kIconServices16PixelDataARGB
with the appropriate value.Then, you write the icon family handle's data out to file. A pointer to the data is obtained by simply dereferencing the handle (i.e.
*iconFamily
). Its size is obtained by callingGetHandleSize((Handle)iconFamily)
.Dispose of any handles you created along the way by calling
DisposeHandle()
.
This requires MacMemory functions from here: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/Mac__Memory.3pm.html
I was wondering how come NewHandle
and GetHandleSize
and DisposeHandle
are not in ostypes repo, I was wondering how would I define these to use thse functions?
Thanks
Hi there,
CGFloat defintions needs fix please:
osxtypes/modules/CoreGraphics.jsm
Line 1611 in b359c65
if64bit it is ctypes.double if 32bit then its ctypes.float
Found bug here: https://github.com/philikon/osxtypes/blob/master/modules/CarbonCore.jsm#L31
kFSEventStreamEventIdSinceNow is defined as -1. I guess C compiler takes this. but typedef of this is FSEventStreamEventId which is typedef of UInt64 which is typedef of ULL (ctypes.unsigned_long_long) and in js-ctypes it denies dangerous cast, like signed to unsigned so we have to defined this as ctypes.unsigned_long_long('0xFFFFFFFFFFFFFFFF')
you can see this in action here: https://github.com/Noitidart/jscFileWatcher/blob/removePath-flesh-out/modules/workers/FSWPollWorker.js#L583
i verified this is true by testing in action. the sinceNow arg works properly and events are given from proper sinceNow.
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.