Created
September 16, 2011 00:46
-
-
Save ianloic/1220902 to your computer and use it in GitHub Desktop.
Tell the Rdio desktop app to search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Build this with: | |
* gcc desktopsearch.m -o desktopsearch -ObjC -framework Cocoa | |
*/ | |
#include <Cocoa/Cocoa.h> | |
int main(int argc, char** argv) { | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
if (argc == 2) { | |
NSString* url = [NSString stringWithFormat: @"http://www.rdio.com/#/search/%s/", | |
argv[1]]; | |
[[NSWorkspace sharedWorkspace] | |
openURLs:[[NSArray alloc] initWithObjects:[NSURL URLWithString:url],nil] | |
withAppBundleIdentifier:@"com.rdio.Desktop" | |
options:NSWorkspaceLaunchDefault | |
additionalEventParamDescriptor:NULL | |
launchIdentifiers:NULL]; | |
} else { | |
printf("%s <search query>\n", argv[0]); | |
} | |
[pool release]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment