Tuesday, January 1, 2013
Sunday, December 30, 2012
Re: NSSharingService on mountain lion without sharing window
Thanks etresoft.
Learning the facebook API and building an app is one way.
I'm trying to find the quickiest way, at first.
The only way I managed that is using a virtuall mouse with this kind of command from an other program
CGPoint pt;
pt.x = 1000;
pt.y = 400;
CGEventRef moveMouse = CGEventCreateMouseEvent (NULL,kCGEventMouseMoved,pt,NULL);
CGEventPost (kCGHIDEventTap, moveMouse);
CGEventRef cam move, click, drag, ...like an real mouse.
So, I'm using it to click on the publish button.
It's not a great solution but it works.
I wonder if it's possible in macOS developpement to have a pointer on a window (the front window of an application for example) and sends command to it (like enter-which means public in my case- or cancel).
Saturday, December 29, 2012
Re: NSSharingService on mountain lion without sharing window
You would have to integrate with the various social media services on your own. Apple wants to keep the user in charge so there is always going to be a cancel button.
NSSharingService on mountain lion without sharing window
On mountain lion, I try the new sharing possiblities with the NSSharingService class of AppKit.framework
Everything goes fine with this three lines of code
NSArray* array = @[ @"myText", [NSImage imageNamed:@"myImageFile"] ];
NSSharingService* sharingServiceFB = [NSSharingService sharingServiceNamed:NSSharingServiceNamePostOnFacebook];
[sharingServiceFB performWithItems:array];
But, when I run this code awindow appears asking me if I want to "Publish" or "Cancel"
I'd like to do the same sharing without this window generated by the performWithItems function.
As I'm considering that the user of my application don't want to confirm.
I've looked in the NSSharingService reference and I don't see any functions that can help me.
I figure that I need send a "Publish" command to this window. I'm new to objective c and I don't really know how to figure it out (or even if it's the best solution).
Any help would be appreciated.