Created
October 29, 2010 23:01
-
-
Save atr000/654624 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#import <Foundation/Foundation.h> | |
int main(int argc, const char* argv[]) | |
{ | |
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; | |
NSAppleScript* script = [[NSAppleScript alloc] initWithSource:@"tell application \"Finder\"\nclean up window of desktop\nend tell"]; | |
while ( true ) | |
{ | |
NSAutoreleasePool* pool2 = [[NSAutoreleasePool alloc] init]; | |
[script executeAndReturnError:nil]; | |
sleep(30); | |
[pool2 release]; | |
} | |
[pool drain]; | |
return 0; | |
} |
@unixpickle: [[NSThread currentThread] sleepForTimeInterval:] is incorrect because sleepForTimeInterval: is a class method. You mean [NSThread sleepForTimeInterval:] instead.
Ah yes you got my on that one. Generally when I am using Xcode, code highlighting is a quick way of telling of something is declared, but obviously we don't have that here :-P
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interesting to see. I might suggest using [[NSThread currentThread] sleepForTimeInterval:] instead of sleep() since it is native to cocoa. Other than that, completely perfect.