# Author: Christoph Stoettner
# E-Mail: christoph.stoettner@stoeps.de
# Blog: http://www.stoeps.de

# Check if applications are running
print "Getting application status of all installed applications..."

applications = AdminApp.list().splitlines();

for application in applications:
    applName = AdminControl.completeObjectName( 'type=Application,name=' + application + ',*' )
    if applName != '':
        aStatus = 'running';
    else:
        aStatus = 'stopped';
        print 'Application: ' + application + ' is ' + aStatus

# ToDo: Change Script to write Application name and status to a dictionary, then sort this dict and print
# grouped Applications, first running, after this stopped applications.

# If this works -> change DataSource Script to print grouped status.

# ToDo: Put this in a function, that function can be used in other scripts.

@@ -244,16 +244,51 @@
 nes();%0A%0A
+runningApps = %5B%5D%0AstoppedApps = %5B%5D%0A%0A
 for appl
@@ -460,16 +460,58 @@
 nning';%0A
+        runningApps.append( application )%0A
     else
@@ -553,385 +553,232 @@
     
-print 'Application: ' + application + ' is ' + aStatus%0A%0A# ToDo: Change Script to write Application name and status to a dictionary, then sort this dict and print%0A# grouped Applications, first running, after this stopped applications.%0A%0A# If this works -%3E change DataSource Script to print grouped status.%0A%0A# ToDo: Put this in a function, that function can be used in other scripts.
+stoppedApps.append( application )%0A%0Aprint ''%0Aprint '%5CtRUNNING APPLICATIONS: %5Cn'%0Afor app in runningApps:%0A    print '%5Ct%5Ct' + app%0A%0Aprint ''%0Aprint '%5CtSTOPPED APPLICATIONS: %5Cn'%0Afor app in stoppedApps:%0A    print '%5Ct%5Ct' + app%0A%0Aprint ''
 %0A

Print running and stopped Applications