generic output

Hi,
i’ve some problems:
⁃ retrieve and open the last open document from a generic app
⁃ control if a generic app is busy or not
⁃ distinguish system processes from hidden apps?