/CopyLocationToClipboardService/CopyCurrentLocationService.m
http://osxsystemservices.googlecode.com/ · Objective C · 42 lines · 13 code · 7 blank · 22 comment · 0 complexity · c5539f49b444776dad7e989b8bcad34b MD5 · raw file
- /*
- * CopyLocationToClipboardService
- *
- * Created by Ron Olson on 9/6/10.
- * Copyright 2010 Ron Olson. All rights reserved.
- *
- * You are free to use this code any way you want.
- * Hopefully it will help you in whatever you're doing.
- */
- #import <Foundation/Foundation.h>
- #import "CopyCurrentLocationProvider.h"
- int main (int argc, const char * argv[])
- {
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-
- /*
- * This is basically boiler-plate code for a service-specific application
- * that does not have an interface (i.e. part of a larger application).
- *
- * The key part is to instantiate the provider object (CurrentLocationProvider here),
- * register the service, then go into the run loop.
- */
-
- CopyCurrentLocationProvider *currentLocationInstance = [[CopyCurrentLocationProvider alloc] init];
- NSRegisterServicesProvider(currentLocationInstance, @"CopyCurrentLocationService");
-
- /*
- * Limit the run time to 30 seconds
- */
- [[NSRunLoop currentRunLoop] acceptInputForMode:NSDefaultRunLoopMode
- beforeDate:[NSDate dateWithTimeIntervalSinceNow:30.0]];
-
- /*
- * And if we're here, we're done with this run of the service
- */
- [currentLocationInstance release];
-
- [pool drain];
-
- return 0;
- }