Appleはこの種の情報を取得する方法を提供していません。
しかし、AppleScriptを使用するなどの「ダーティな」方法があります。
次のスクリプトはFinderによる「コピーウィンドウ」がアクティブであるかどうかを検出します:
(すばやく書かれていて、徹底的にテストされていませんが、うまく機能しているようです)
set thestatus to "not copying"
tell application "System Events"
set theList to get the title of every window of process "Finder"
repeat with theItem in theList
if theItem contains "Copy" then
set thestatus to "copying"
end if
end repeat
end tell
thestatus
最後にObjective-CからこのAppleScriptを実行するために NSAppleScript
を使用してください
NSString *theScript = @"set theStatus to \"not copying\"\n"
"tell application \"System Events\"\n"
"set theList to get the title of every window of process \"Finder\"\n"
"repeat with theItem in theList\n"
"if theItem contains \"Copy\" then\n"
"set theStatus to \"copying\"\n"
"end if\n"
"end repeat\n"
"end tell\n"
"theStatus";
NSDictionary *errorInfo = nil;
NSAppleScript *run = [[NSAppleScript alloc] initWithSource:theScript];
NSAppleEventDescriptor *theDescriptor = [run executeAndReturnError:&errorInfo];
if ([[theDescriptor stringValue] isEqualTo:@"copying"]) {
NSLog(@"Finder is copying");
} else {
NSLog(@"Finder is not copying");
}