From 02a72745332764ca4e7ed48b0d26fe5e083ecefc Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 21 Jul 2012 01:34:14 -0400 Subject: Got system beep to play (the one I wanted). Finally. --- On Task.m | 16 ++++++++++++++-- On Task.xcodeproj/project.pbxproj | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/On Task.m b/On Task.m index 8b06bfc..a4e67e5 100644 --- a/On Task.m +++ b/On Task.m @@ -1,4 +1,4 @@ -#import +#import #import "NSFileManager+DirectoryLocations.h" @@ -14,13 +14,25 @@ int main (int argc, const char * argv[]) { [df setDateFormat:@"yyyyMMddHHmmss"]; NSString *date = [df stringFromDate:[NSDate date]]; - // Take screenshot + // # Take screenshot 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 waitUntilExit]; [takeScreenshot release]; + + // # Play system beep + NSSound *beep = [NSSound soundNamed:@"Tink"]; + [beep play]; + while ([beep isPlaying]) { + // Don't exit the program before the sound finishes + } + + + // # Open text log + [df release]; [pool release]; diff --git a/On Task.xcodeproj/project.pbxproj b/On Task.xcodeproj/project.pbxproj index 8e9ab61..b2035a4 100644 --- a/On Task.xcodeproj/project.pbxproj +++ b/On Task.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 8DD76F9F0486AA7600D96B5E /* On Task.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* On Task.1 */; }; D17EB4E115BA572600A0FB10 /* NSFileManager+DirectoryLocations.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = D17EB4DF15BA572600A0FB10 /* NSFileManager+DirectoryLocations.h */; }; D17EB4E215BA572600A0FB10 /* NSFileManager+DirectoryLocations.m in Sources */ = {isa = PBXBuildFile; fileRef = D17EB4E015BA572600A0FB10 /* NSFileManager+DirectoryLocations.m */; }; + D18C272A15BA6FC0007BE5BA /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D18C272915BA6FC0007BE5BA /* AppKit.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -36,6 +37,7 @@ C6859EA3029092ED04C91782 /* On Task.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "On Task.1"; sourceTree = ""; }; D17EB4DF15BA572600A0FB10 /* NSFileManager+DirectoryLocations.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = "NSFileManager+DirectoryLocations.h"; path = "Classes/NSFileManager+DirectoryLocations.h"; sourceTree = ""; }; D17EB4E015BA572600A0FB10 /* NSFileManager+DirectoryLocations.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = "NSFileManager+DirectoryLocations.m"; path = "Classes/NSFileManager+DirectoryLocations.m"; sourceTree = ""; }; + D18C272915BA6FC0007BE5BA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -44,6 +46,7 @@ buildActionMask = 2147483647; files = ( 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + D18C272A15BA6FC0007BE5BA /* AppKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -75,6 +78,7 @@ 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( + D18C272915BA6FC0007BE5BA /* AppKit.framework */, 08FB779EFE84155DC02AAC07 /* Foundation.framework */, ); name = "External Frameworks and Libraries"; -- cgit v1.2.3