Hi,By enumerating desktop windows in Xcode,In macOS 10.14.6, it is easy to get window name by window number.In macOS 10.15.1, it is unable to get window name in the same flow. (ref. source code below)---------------------------------------------------------------------------------CFArrayRef windowList = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);for (NSMutableDictionary* entry in (__bridge NSArray*)windowList){ NSString* owner = [entry objectForKey:(id)kCGWindowOwnerName]; NSString* Name = [entry objectForKey:(id)kCGWindowName]; NSString* ownerPID = [entry objectForKey:(id)kCGWindowOwnerPID]; NSInteger win_num = [[entry objectForKey:(id)kCGWindowNumber] integerValue]; if( num == win_num ) { ownerName = owner; //ex: "Finder" windowName = Name; // "nil" in macOS 10.15.1 NSLog(@"drag window found: %@, %@: %d", ownerName, windowName, (int)win_num); break; }}CFRelease(windowList);---------------------------------------------------------------------------------"windowName" is necessary along with "ownerName" to move desktop window to specified position by Apple script.I try to have my app get “Accessibility” priviledge in “Security & Privacy” panel, but in vain.How to get "windowName" in macOS 10.15.x ?Is there other way to move window in macOS 10.15 or above?Sincerely,Yiming
Post
Replies
Boosts
Views
Activity
Hi,Privacy_Camera & Privacy_Microphone Usage description can be found in info.plist to trigger privilege.Is there any privacy_* key in info.plist in Xcode to trigger "ScreenRecoding" Privilege ?Thanks,Yiming
Hi,GoodDay !To reset "Screen Recording" privilige, open "Terminal" and type "tccutil reset ScreenCapture".I am wondering what the corresponding name to "Files and Folders" is."tccutil reset FilesAndFolders" doesn't work.Sincerely,Thank you.YM
Hi,I would like to get desktop(workspace) number among desktops in macOS.Since "kCGWindowWorkspace" is deprecated from macOS 10.8, is there an alternative way to enumerate workspace?Thanks,YM
Hi,For Macbook Pro 16, it is capable to play 5K media smoothly.Is there a patch for old Macbook Pro 15 to play 5K media ??Thanks,Yiming
Hi,
Detecting "Accessibility" granted or not will work using "AXIsProcessTrustedWithOptions" API in Xcode with compile source as "According to file type".
But changing Xcode setting with compile source as "Objective C++" will make "AXIsProcessTrustedWithOptions" API always return "NO" since the Accessibility privilege is granted in "Security & privacy".
Does anyone have any idea about this?
Thanks,
YM
Platform: macOS 12.3.1
Xcode: 13.3
I had Xcode ARC turned ON.
AppleScript should be declared like below.
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:strScript];
When call AppleScript, open "Monitor.app" app will observe some memory leak.
I try to wrap AppleScript by autoReleasePool. Memery leak still exists
@autoreleasepool {
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:strScript];
//script to do something
}
Is there other suggestion to do gabage collection to release memory?
Recently we surveyed macOS file association by extension to retrieve what app to “open with”.
Ex: image.png -> “Preview” to open
“URLsForApplicationsToOpenContentType”(macOS 12.0+) is a good API which returns NSArray for “open with” app list.
https://developer.apple.com/documentation/appkit/nsworkspace/3752999-urlsforapplicationstoopencontent
May I ask the alternative for “URLsForApplicationsToOpenContentType” below macOS 12.x ?
“LSCopyDefaultApplicationURLForContentType” (macOS 10.10–12.00) is “Deprecated”.
https://developer.apple.com/documentation/coreservices/launch_services?language=objc
Hi,
Recently we tested how to minimize app using Applescript as below picture and find some interesting phenomenon.
After executing the script, if “miniaturized” marked in green (recognized as parameter), it failed to set minimize property.
If “miniaturized” marked in purple, it is ok to set minimize property.
Because the syntax is exactly the same, could you help to guide us what is wrong with the script?
Sincerely,
Thanks,
YM
When changing icc profile in macOS14.x, app may get 2 "NSApplicationDidChangeScreenParametersNotification".
And some platform is normal like M2 Pro Mac mini v14.4.1 will receive once.
Any idea about this symptom?