var PS = Application ( "Adobe Photoshop CC 2014" ) ; var doc = PS . documents [ 0 ] ; var text = "" ; for ( var i = 0 ; i < doc . layers . length ; i ++ ) { var appName = doc . layers [ i ] . name ( ) ; text = text + appName + "\n" ; } var TextEdit = Application ( "TextEdit" ) ; var teDoc = TextEdit . Document ( ) ; TextEdit . documents . push ( teDoc ) ; teDoc . text = text ;