Questions tagged [nsrunningapplication]
44 questions
11
votes
1 answer
how to get windows of NSRunningApplication
I want to get the window list for a running application.
I can get the running application list from [[NSWorkspace sharedWorkspace] runningApplications], but the window list is only available on NSApplication.
Is there some way to convert from…

pvinis
- 4,059
- 5
- 39
- 59
8
votes
2 answers
Getting NSRunningApplication using a ProcessSerialNumber
I have an AppleEventDescriptor where I need to get the sending application's bundle identifier. The Apple Event contains a typeProcessSerialNumber that can be coerced into a ProcessSerialNumber.
The problem is that GetProcessPID() was deprecated in…

chockenberry
- 7,811
- 5
- 32
- 41
5
votes
2 answers
How to get the PID from a ProcessSerialNum in OSX 10.9?
GetProcessPID was marked deprecated in OSX 10.9 along with the note:
Use the processIdentifier property of the appropriate
NSRunningApplication object.
The problem is the constructing class methods for NSRunningApplication do not have a way to…

Joseph Lennox
- 3,202
- 1
- 27
- 25
5
votes
1 answer
unable to detect application running with another user (via switch user)
Use case: I login as "user1" and launch Safari, then I click "user1" on top-right corner and switch user to "user2".
Now, I am trying to detect whether Safari is running for "user1" but I am unable to do so with standard calls. I am using OS X 10.8…

dDarkLORD
- 624
- 7
- 25
4
votes
1 answer
How to use KVO to detect when an application gets active?
I have the following code in a Cocoa application:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSArray* arrayAppList = [[NSWorkspace sharedWorkspace] runningApplications];
}
My intention is to use KVO to detect an…

willyMon
- 612
- 8
- 19
4
votes
0 answers
How to detect another instance of a Swift app is already running
I am trying to detect in my Swift app if an instance is already running, and if so, refrain the user from launching another instance. I am using NSRunningApplication class to detect such behavior but am having trouble getting it to work properly. I…

Kenny
- 429
- 6
- 22
4
votes
3 answers
How to add listener for all running applications
I want to display a list of all running application names.
Issue: It doesn't add an app that is running after the function is called. Therefore, it doesn't add the app name to the list
simultaneously.
Goal: I want to add a listener, so if a new app…

dbrownjave
- 437
- 1
- 8
- 19
4
votes
2 answers
NSRunningApplication, return list of recently used applications?
I'm trying to get a list of the most recently used applications. NSWorkspace returns a list of active applications and I can sort them on a few options using NSRunningApplication. see list below:
- launchDate
- finishedLaunching
-…

Martijn
- 101
- 1
- 2
- 5
4
votes
1 answer
Filter [NSWorkspace runningApplications] to contain only user applications (no daemons/UIAgents)
Is there a way to filter the list of applications given by [NSWorkspace runningApplications] to hide all daemons, etc short of manually checking each application's plist for the UIAgent key? If an application doesn't show in the dock, I'm not…

John Wells
- 1,139
- 1
- 10
- 27
3
votes
1 answer
get the bundle identifier of an application running from another user
The scenario is like this: "I run an app (say myproc) from one user and then fast user switch to second user"
Now, when I try to determine all processes running with a particular bundle Identifier (say com.ak.myproc); I am not able to determine this…

dDarkLORD
- 624
- 7
- 25
2
votes
0 answers
Console closes immediately after I run Python code on Windows 10
Though I use input() at the end of my code, the console stil immediately closes after entering the name in the window in Windows 10 (outside of IDLE), and I cannot see the result. What can I do to stop the console from closing?
#! python 3
name =…

Mohammadreza
- 79
- 2
- 9
2
votes
0 answers
How to make a running application on macos to float above other apps?
I am making an application that can set a running application window to float above other apps so that if you click outside of the app's window, its window will still remain on the screen.
I have tried to use app.activate(options:…

Lucian Boiangiu
- 61
- 3
2
votes
1 answer
NSRunningApplication terminate() returning false
Building a macOS app that gets the currently active NSRunningApplication.
public func findActiveApp() -> NSRunningApplication? {
for app in NSWorkspace.shared.runningApplications {
if app.isActive {
return app
}
…

Jad El Jerdy
- 46
- 4
2
votes
0 answers
Why does [NSRunningApplication activateWithOptions:] return NO
I am having a problem where [NSRunningApplication activateWithOptions:] returns NO when there is no obvious reason that it should fail to activate an application.
This is not a duplicate of -[NSRunningApplication activateWithOptions:] not…

RGB World
- 399
- 1
- 6
- 19
2
votes
1 answer
NSRunningApplication does not have specific app window
I want my application to know which all apps are currently running and show in a table. In table it will show all running apps names with a button beside each app. On Click of button we have to open the window of the specific app even if it is…

Juno
- 347
- 2
- 11