Is there a way to user activity in outside apps using python?

  python, windows

I’m trying to make a program that collects data on user activity and was wondering if there was an easy way to find what actions they are taking in other apps. For example, if they selected cell C3 in excel, is there a way to save that besides their mouse click location? I assume it would vary between apps, but some guidance on where to look would be very helpful.

Also, I’ve been able to work with active processes using psutil, but I couldn’t figure out a way to see the order of apps on screen. Is there a way to check this in python, such as the order apps appear when you alt tab? I am currently working with windows

Source: Windows Questions