var TextEdit = Application ( "TextEdit" ) ; TextEdit . includeStandardAdditions = true ; var desktop = TextEdit . pathTo ( "desktop" , { from : "user domain" } ) ; var filepath = Path ( desktop + "/sample.txt" ) ; TextEdit . open ( filepath ) ;