diff options
| author | Teddy Wing | 2012-07-21 00:48:48 -0400 | 
|---|---|---|
| committer | Teddy Wing | 2012-07-21 00:48:48 -0400 | 
| commit | 87306f8ca78901b1d6e79dc74428d32e29193f63 (patch) | |
| tree | f3e6ca9103d14b4f073146979c046b5f65e76a5a | |
| parent | 4c39f3ef9e67ddd6b05fd3c1fb00f5e3b1ca08d6 (diff) | |
| download | On-Task-87306f8ca78901b1d6e79dc74428d32e29193f63.tar.bz2 | |
Now takes a screenshot and calls it the current date & time.
| -rw-r--r-- | On Task.m | 15 | 
1 files changed, 14 insertions, 1 deletions
| @@ -5,10 +5,23 @@  int main (int argc, const char * argv[]) {      NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; +	// Get Application Support dir path  	NSString *supportPath = [[NSFileManager defaultManager] applicationSupportDirectory]; +	// Get a date string +	[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4]; +	NSDateFormatter *df = [[NSDateFormatter alloc] init]; +	[df setDateFormat:@"yyyyMMddHHmmss"]; +	NSString *date = [df stringFromDate:[NSDate date]]; +	      // Take screenshot -	NSLog(@"%@", supportPath); +	NSTask *takeScreenshot = [[NSTask alloc] init]; +	[takeScreenshot setLaunchPath:@"/usr/sbin/screencapture"]; +	[takeScreenshot setArguments:[NSArray arrayWithObjects:@"-SxC", [supportPath stringByAppendingString:[NSString stringWithFormat:@"/%@.png", date]], nil]]; +	[takeScreenshot launch]; +	[takeScreenshot release]; +	 +	[df release];      [pool release];      return 0; | 
