AppleScript基础教程:对象、属性、命令与数据类型解析

需积分: 44 37 下载量 199 浏览量 更新于2024-08-08 收藏 2.4MB PDF 举报
"AppleScript基础教程-ak09911-preliminary-e-00" AppleScript是一种面向对象的脚本语言,它基于三个核心概念:对象、属性和命令。对象,或称为“类”,代表具体的事物,比如汽车,它可以是整体也可以是其组成部分,如轮子、车门等,这些部分在OO概念中被称为子类,具有层次结构。属性是对象的特性,如汽车的颜色、长度和重量,它们赋予对象具体的特征。命令,又称为方法,是脚本执行的操作或指令,类似于非面向对象语言中的函数。 在AppleScript中,标识符用于命名对象、属性等,它们必须以英文字母开头,可以包含26个英文字母、10个阿拉伯数字和下划线。特殊情况下,如果标识符以“|”开始并结束,可以使用任何Unicode字符,但不包括“|”本身。合法的标识符示例包括“abcd”、“ABC_91”和“|a&b*c|”。关键字是AppleScript保留的具有特殊含义的标识符,不能用于自定义,例如某些语法结构。 AppleScript支持多种数据类型,包括Boolean(布尔型,只有True和False两种值)、Number(数字型)、Integer(整型)和Real(实型),如1、1.0、1.1和-1.56。这些数据类型既可以由AppleScript内置,也可以由应用程序定义。 本教程旨在提供简单易懂的AppleScript基础知识,适合初学者。作者强调,AppleScript学习轻松,实用性高,能帮助节省时间,自动化处理日常任务。教程内容包括AppleScript的入门介绍、工作原理、应用场景、与Automator的结合使用,以及如何快速上手AppleScript编辑器。教程还涵盖了标识符的规则、关键字的使用和各种数据类型的介绍,旨在帮助读者更好地理解和应用AppleScript。

解释:% 'Distance' - Distance measure, in P-dimensional space, that KMEANS % should minimize with respect to. Choices are: % {'sqEuclidean'} - Squared Euclidean distance (the default) % 'cosine' - One minus the cosine of the included angle % between points (treated as vectors). Each % row of X SHOULD be normalized to unit. If % the intial center matrix is provided, it % SHOULD also be normalized. % % 'Start' - Method used to choose initial cluster centroid positions, % sometimes known as "seeds". Choices are: % {'sample'} - Select K observations from X at random (the default) % 'cluster' - Perform preliminary clustering phase on random 10% % subsample of X. This preliminary phase is itself % initialized using 'sample'. An additional parameter % clusterMaxIter can be used to control the maximum % number of iterations in each preliminary clustering % problem. % matrix - A K-by-P matrix of starting locations; or a K-by-1 % indicate vector indicating which K points in X % should be used as the initial center. In this case, % you can pass in [] for K, and KMEANS infers K from % the first dimension of the matrix. % % 'MaxIter' - Maximum number of iterations allowed. Default is 100. % % 'Replicates' - Number of times to repeat the clustering, each with a % new set of initial centroids. Default is 1. If the % initial centroids are provided, the replicate will be % automatically set to be 1. % % 'clusterMaxIter' - Only useful when 'Start' is 'cluster'. Maximum number % of iterations of the preliminary clustering phase. % Default is 10. %

2023-05-18 上传