Get a list of running processes, get the active process (and its application) Flex / AIR

just quickie (or maybe not:]):

Is it possible to get a list of running applications / processes, and while working in the background, check which process is active?

In addition, if the answer was yes in some way, is it possible to react to changing the active window / application in the same way as if it were an event, or to associate a custom event with it (for example, Event.SystemActiveAppChange )?

Thanks for the answers as well as for the pointers.

EDIT : due to a possible misunderstanding, I mean local applications - on your win / mac / linux machine - I would like (as I learn the language) to keep track of which applications I use the most, can I make a small schedule?

So, the fact is that in an AIR application developed in FLEX, I would like to get / list all running applications / processes, as well as which one is active (on a user's PC / Mac / Linux)

+4
source share
3 answers

Unfortunately, this is not possible because AIR has no access to either process information or system performance metrics.

Your only hope will be to create another service in .NET or Objective-C (such as a cross-platform, if necessary) that can provide process information to your AIR application through a local NetConnection . I'm not sure about Java, but you can get away with Mono.

+3
source

This is exactly the same as what I'm learning!

Although I think that there are still no built-in APIs for this, with the new AIR 2.0 you can use NativeProcess so that you can clear the output of command-line tools like top or ps on OSX. In fact, I have proof of the launch and launch of the concept, which allows the AIR application to control the CPU usage inside the application using ActionScript, although it is a bit slow, it cannot be lower than the sampling frequency by 1.5 seconds.

But I don’t want to be too distracted, I still could not understand what command line tools can be used to get an active application / window, but I just opened a question that can be a workaround for your question: What command line tools can I use for getting an active application / window on each platform?

+2
source

You can use the newconnection class to ping back and forth while the applications remain alive: http://www.adobe.com/livedocs/flex/3/langref/flash/net/NetConnection.html

  • main application can send netConnection.send (mainConnection, "sendMessageBack") queue timer start
  • the child application will be launched in the sendMessageBack netConnection.send (childConnection, "setStatusOk") function.
  • the main application can check (on the same timer, que 1) if setStatusOk was called, if you do not remove Event.SystemActiveAppChange
+1
source

Source: https://habr.com/ru/post/1299349/


All Articles