Scriptable key from runningApplicaions

Example of a script to return scriptable key from runningApplicaions

use framework "Foundation"
use framework "AppKit"
use scripting additions

set workspace to (current application's NSWorkspace's sharedWorkspace())'s runningApplications()

repeat with anApp in workspace
	set {theResult, theKey, theError} to ((anApp's bundleURL())'s getResourceValue:(reference) forKey:(current application's NSURLApplicationIsScriptableKey) |error|:(reference))
	if theResult then
		set theString to (anApp's localizedName() as text) & ", " & (theKey as string) & linefeed
		log theString
	end if
end repeat