def is_scriptable(application):
 if os.path.isdir(application):
  plistfile = os.path.join(application, 'Contents', 'Info.plist')
  if (not os.path.exists(plistfile)):
   return False
  plist = plistlib.Plist.fromFile(plistfile)
  return plist.get('NSAppleScriptEnabled', False)
 currf = CurResFile()
 try:
  refno = macresource.open_pathname(application)
 except MacOS.Error:
  return False
 UseResFile(refno)
 n_terminology = (((Count1Resources('aete') + Count1Resources('aeut')) + Count1Resources('scsz')) + Count1Resources('osiz'))
 CloseResFile(refno)
 UseResFile(currf)
 return (n_terminology > 0)

def is_scriptable ( application ) : if os . path . isdir ( application ) : plistfile = os . path . join ( application , 'Contents' , 'Info.plist' ) if ( not os . path . exists ( plistfile ) ) : return False plist = plistlib . Plist . fromFile ( plistfile ) return plist . get ( 'NSAppleScriptEnabled' , False ) currf = CurResFile ( ) try : refno = macresource . open_pathname ( application ) except MacOS . Error : return False UseResFile ( refno ) n_terminology = ( ( ( Count1Resources ( 'aete' ) + Count1Resources ( 'aeut' ) ) + Count1Resources ( 'scsz' ) ) + Count1Resources ( 'osiz' ) ) CloseResFile ( refno ) UseResFile ( currf ) return ( n_terminology > 0 )
return true if the application is scriptable .