游乐场都有什么项目| 女性更年期挂什么科| 援交什么意思| 1974年是什么年| camel是什么颜色| 毒龙是什么意思| 荆州是现在的什么地方| 芥末是什么味道| 吃什么食物补铁| 查输卵管是否堵塞要做什么检查| 开车压到猫有什么预兆| 重字五行属什么| 牛有几个胃分别叫什么| 什么辣椒香而不辣| 中药一般什么时候喝最好| 蜜饯是什么东西| 喝什么排肝毒最快| 心脏变大是什么原因| 2003年属羊是什么命| 女人喝什么茶叶好| 木驴是什么| 生殖疱疹用什么药效果好| 为什么冰箱冷藏室会结冰| 一月25号是什么星座| media是什么意思| 梦见数字是什么意思| 剂量是什么意思| 李白是什么| 跳蛛吃什么| 胃寒湿气重吃什么药效果最好| 日出扶桑是什么意思| paco2是什么意思| 茶寿为什么是108岁| 亮丽是什么意思| 补办身份证需要什么手续| 吃了螃蟹后不能吃什么| 蜗牛的触角有什么作用| 时光荏苒是什么意思| 吃什么药怀孕最快| 鼠入牛角是什么动物| 梦见烧衣服什么预兆| 面部提升做什么项目最好| 任性的女孩有什么特点| 喉咙扁桃体发炎吃什么药| 茄子不能和什么一起吃| 0a是什么意思| 皮肤黑是什么原因| 6月18日什么星座| 额头青筋凸起是什么原因| 查激素水平挂什么科| 87年属什么的生肖| 心脏供血不足吃什么药好| 大方得体是什么意思| 脚踩按摩垫有什么好处| 什么的梦| 为什么吐后反而舒服了| 鸭子什么时候下蛋| 清明上河图什么季节| 吃什么补气最快| mrr是什么意思| 关税什么意思| 成都五行属什么| 喝酒后吃头孢有什么反应| 一直放臭屁是什么原因| 护理和护士有什么区别| 阴是什么意思| 恢复伤口的鱼叫什么鱼| 玛咖是什么| 梦见买东西是什么意思| 十一月二十六是什么星座| 总警司相当于大陆什么官| 乳糖是什么糖| 为什么会有白带| 血氧饱和度是什么| 艾草长什么样子图片| 吊孝是什么意思| 什么的月季| 肚脐右边疼是什么原因| 除服是什么意思| 什么是三好学生| 阴历三月是什么星座| 顶胯是什么意思| 不感冒什么意思| hcg什么时候开始下降| 肠胃不舒服吃什么| 马牙是什么原因引起的| 小便尿色黄是什么问题| 胃阳虚吃什么中成药| 宋小宝得了什么病| 脑萎缩有什么症状| 疝外科是治什么病的| 白皮书是什么意思| cashmere是什么意思| 店招是什么意思| 叶酸有什么作用和功效| 三焦指的是什么器官| 蕈是什么意思| 五七年属什么生肖| 花生什么时候收| 高山茶属于什么茶| 宫腔线不清晰什么意思| 忌动土是什么意思| 什么是食物链| 咳嗽痰多是什么原因| 黄精是什么药材| 86年是属什么的| 嗜酸性粒细胞偏高是什么意思| 肚子咕咕叫吃什么药| 西瓜能做什么美食| 老花镜是什么镜| 吃什么水果祛斑最快| 梦到上坟是什么意思| 油炸食品用什么油最好| 鹏字五行属什么| 勃而不坚吃什么药| 感觉牙齿松动是什么原因| 光年是什么单位| 支原体弱阳性是什么意思| 来月经前头痛什么原因| hca是什么意思| jay什么意思| 甲状腺低密度结节是什么意思| 尿红细胞阳性什么意思| 1970年属狗的是什么命| 大便黄色是什么原因| 腊八有什么讲究| 男孩取什么名字好听又有贵气| 三个贝念什么| 6月22日什么星座| 牛油果吃了有什么好处| 鸡鸡长什么样| 全麻对身体有什么危害| 隐睾是什么意思| 嗓子疼咽口水都疼吃什么药| 女人跑马是什么意思| 中暑喝什么| 栀子花开有什么寓意| b超属于什么科室| 梦见自己坐火车是什么意思| 老年痴呆症是什么原因引起的| 大头鱼是什么鱼| 吃什么快速排便| 醋酸是什么面料| 血液循环不好吃什么药| 老汉推车是什么姿势| 县常委什么级别| 水痘是什么原因引起的| uhd是什么意思| 阴道发痒是什么原因| 吃中药不能吃什么水果| 盗汗是什么症状| 筒子骨炖什么好吃| ri是什么意思| 吃什么食物可以降低尿酸| 鱼腥味是什么妇科病| 杜冷丁是什么药| 腰椎膨出是什么意思| 狗又吐又拉稀吃什么药| 颈椎病最怕干什么活| 瘿瘤是什么意思| 虫草花不能和什么一起吃| 纸是什么生肖| snidel是什么牌子| 宁静是什么意思| 鱼能吃什么| 事半功倍是什么意思| 小排畸什么时候做| 为什么叫客家人| 门神是什么意思| 盆腔炎有什么症状呢| 螺旋杆菌阳性是什么病| 咽喉有异物感吃什么药| 小乌龟吃什么东西| 教师节是什么时候| 高血压吃什么食物最好| 西瓜跟什么不能一起吃| 锁骨是什么骨| 肛门瘙痒用什么药| 心计是什么意思| 财神爷供奉什么供品| 钳子什么牌子好| 代孕是什么意思| 接吻有什么好处| 紧张性头痛吃什么药| 口酸吃什么药| 4月23日是什么星座| 12月10号什么星座| 农历10月是什么月| 血儿茶酚胺是查什么的| mb是什么意思| 胆汁反流吃什么药最好| 来月经喝啤酒有什么影响| 今年的属相是什么生肖| 电头是什么| 往返是什么意思| 炖猪蹄放什么调料| 属蛇适合佩戴什么饰品| 请问支气管炎吃什么药最有效| 左眼跳是什么原因| 依托考昔片是什么药| 七月八号是什么星座| 舌苔白厚腻吃什么药| 六月初一是什么日子| 脑萎缩有什么症状| 热狗为什么叫热狗| 生育登记服务单是什么| 三焦指的是什么器官| 五十而知天命是什么意思| 例假期间吃什么食物好| 鋆字五行属什么| 金钱草有什么功效| 殳是什么意思| 什么其谈| 桔子什么时候成熟| 阿甘正传珍妮得了什么病| 乌云为什么是黑色的| 孤臣是什么意思| 欣是什么意思| 受孕是什么意思| 藏红花和什么一起泡水喝效果好| 哥弟属于什么档次| 双向情感障碍是什么病| 小孩自闭症有什么表现| 减肥可以喝什么饮料| 牙齿松动了有什么办法能固齿吗| 败血症吃什么药| 男人喝红糖水有什么好处| 7月1日什么星座| 脖子上长疣是什么原因| replay是什么牌子| 弃市是什么意思| nba新赛季什么时候开始| 区间是什么意思| 胃炎吃什么药效果最好| 腹部疼挂什么科| 堃什么意思| 老天爷叫什么名字| 淘米水洗脸有什么好处| 含胸是什么意思| 蔓越莓有什么功效和作用| 什么鞋穿着舒服| 吃什么补白蛋白最快最好| 小鸡啄米什么意思| 傻瓜是什么生肖| 吃晕车药有什么副作用| 什么情况下| 让心归零是什么意思| 舒字五行属什么的| 骑马野战指什么生肖| 一字千金是什么生肖| 室性期前收缩是什么病| 超声科是什么科室| 为什么眼睛会有红血丝| 全国政协常委什么级别| 治未病是什么意思| 嗓子痛什么原因| 智商135是什么水平| 屁股痛是什么引起的| 吃海参有什么功效| 脚底疼是什么原因| 同心同德是什么意思| 慧命是什么意思| tct检查是什么| 生男生女取决于什么| 百度Jump to content

越南讲什么语言

From Wikipedia, the free encyclopedia
(Redirected from AppleEvent Object Model)
百度 而今真的见到了“一撸到底”,严格治吏的时代终于到来,岂能不点赞一个!*以上只是作者个人言论,不代表本网观点

Apple events are the message-based interprocess communication mechanism in Mac OS, first making an appearance in System 7 and supported by every version of the classic Mac OS since then and by macOS. Apple events describe "high-level" events such as "open document" or "print file", whereas earlier OSs had supported much more basic events, namely "click" and "keypress". Apple events form the basis of the Mac OS scripting system, the Open Scripting Architecture (the primary language of such being AppleScript).

The starting point is a dynamically-typed, extensible descriptor format called an AEDesc, which is just an OSType code specifying the data type, together with a block of type-dependent data. For instance, the OSType code inte indicates that the data was a four-byte signed integer in big-endian format.

Besides predefined type codes for various common simple types, there are two predefined structured descriptor types: an AERecord, which has data type reco (record), and AEList with type list (list or array). The internal structure of these contain recursively-nested AEDescs, while the AERecord also associates each element with a unique record field ID, which is an OSType. The Apple Event Manager provides API calls to construct these structures, as well as extract their contents and query the type of contents they hold.

The Apple Event Manager also supports coercions, which converts AEDescs from one data type to another. In addition to standard coercions, for instance between integer and real types, applications can install their own coercion handler callbacks, which handle conversions to and from custom data types.

An Apple event proper is an AERecord with fields that depended on the purpose of the event. In addition, it has attributes (which are distinct from record fields, which are now called the parameters of the event) from a set predefined by the Apple Event Manager. These specify what the event is supposed to do (through event class and event ID), the target address to which the event is to be sent (which could be a process on the local or a remote machine), and various other options for handling it. Remote machines initially had to be connected via AppleTalk, but Mac OS 9 added the option for connections via TCP/IP.

After sending an Apple event to its target process, the sending process can elect to receive a reply to an Apple event. This can contain various bits of information returned from the target about the processing of the original event, including an error code indicating success/failure, any information requested by the original event, and/or other appropriate information.

Apple events are the foundation of the AppleEvent Object Model, which in turn is the foundation of the OSA and AppleScript. As of 2016, the official implementation of the Apple Event Manager API is available in C and its descendants, including C++. Official bindings are also provided for Objective-C and Swift through the Cocoa API. Unofficial bindings also exist for other languages (with varying degrees of limitation), including Perl, UserTalk, Ruby and Python.

Object Model

[edit]

The AppleEvent Object Model (AEOM) was a set of protocols built on top of AppleEvents by which applications running under classic Mac OS and macOS could control each other's functions. Applications that implemented some part of the AEOM were called scriptable because they could be controlled via AppleScript. Unfortunately, scriptability support remained patchy and inconsistent throughout the history of classic Mac OS.

The AEOM provided a syntactic layer under which any application could publish its internal objects, allowing those objects to be manipulated in a standardized way. Unlike other similar-sounding concepts such as ToolTalk, there was a clear, orthogonal distinction between nouns and verbs; thus, instead of providing separate commands for "close document" and "close window", there was a single "close" verb which could take references to "document" or "window" objects, or any other object that the application published.

The objects that an application made available through its AEOM support were arranged in a hierarchy. At the top was the application itself, referenced via a null object descriptor. Other objects were referenced by (recursively) specifying their parent object, together with other information identifying it as a child of that parent, all collected in an AERecord. An iterator was provided by parents to enumerate their children, or children of a certain class, allowing applications to address a set of elements. The system was generally similar to the Document Object Model used in XML, although with some differences in access patterns.

Each object could have elements and properties; elements were other objects, which might be created or deleted, while properties could not be created or deleted but had values which might be interrogated or changed. For instance, the application might have one or more window elements representing windows showing the contents of currently-open documents. These windows might have properties such as their title, position and size.

An application could define custom verbs for operating on its objects. The AEOM also specified various standard verbs which (it was hoped) applications would implement in a consistent fashion, such as open, close, create element, delete, set data, and get data. Each verb was defined as an AppleEvent of a specific type and class, together with particular parameters of particular types that were expected to be present. For instance, the "get data" event was the standard means for obtaining the value of a property: it took essentially one parameter, which was an object descriptor identifying the property to be queried. The value of that property would be returned in the reply event. The "set data" event took two parameters, the object descriptor for the property to set and the new value for the property; the reply event was only expected to return a success status or failure error code.

The entire AppleEvent architecture identifies things using four-byte OSType codes, studiously avoiding actual words or phrases in English (or any other language). Instead, the correspondence between internal AppleEvent codes and external natural-language descriptions is specified through the aete (AppleEvent Terminology Extension) resource — the "extension" being to the standard terminology built into AppleScript itself. An application may provide multiple 'aete' resources for multiple languages, in keeping with the original multilingual design of AppleScript itself

For instance, consider the following AppleScript sequence controlling a fictional drawing application:

 tell application "ScriptableDraw"
   set background color of window "New Drawing" to background color of window "Old Drawing"
 end tell

This actually involves the sending of two AppleEvents to the target application (and the receipt of their corresponding replies): first, a get-data event is sent to retrieve the background color property of the window identified by the name "Old Drawing"; then a set-data event is sent to apply the value returned as the background color property of the window named "New Drawing".

Since this sort of access pattern was typical, AppleScript made widespread use of the tell statement, which switched the context to the named object in a fashion similar to the with statement found in Visual Basic or Pascal. All commands after the tell to the corresponding end tell would be sent to the object named in the tell, instead of the default object, which was the current application.

Object descriptors allowed the identification of objects in various ways. The most interesting one was using a where-clause (which translated into AppleScript terminology as a filter expression). For instance, the AppleScript 1.0 SDK shipped with the source code for an example application called the Scriptable Text Editor, which would respond to scripts such as:

 tell application "Scriptable Text Editor"
   tell window "Example Document"
     set text style of every word whose length > 7 to bold
   end tell
 end tell

Even today, it is rare to find this kind of power in general-purpose scripting languages outside of SQL.

Adding support for the AEOM in the classic Mac OS was a difficult process. Application developers had to identify their objects and hand-write code to allow them to be addressed. This typically took the form of code for returning the "next" object of a particular type, allowing AppleScript to iterate over them. But since the OS did not contain an object model, this work was left entirely to the developers, many of whom did not implement it. Oddly, even Apple's own application framework, MacApp, did not offer such a model except for the GUI objects it knew about, once again making the developer do most of the work of scripting the objects representing the data itself. Largely for these reasons, AppleScript support was not very widespread.

Apple did attempt to address this problem with the introduction of various object "suites", which represented standard objects and verbs that were expected to be supported by different types of applications. For instance, all applications were expected to support the "core suite", and any application editing text was expected to support the "text suite". By selecting a suitable set of suites, the developer could at least reduce the workload of planning how to expose their objects. Yet because these objects were generally not part of the system itself (with the exception of the severely limited TextEdit editor), the actual implementation was left to the developer.

Applications developed in Cocoa, the system formerly known as OpenStep, offer a rich object runtime that can be queried from any other application. This makes implementation of the AEOM considerably easier, dramatically reducing the amount of code needed in the average application. Additionally the majority of Cocoa applications are constructed primarily from Cocoa-standard objects, all of which were upgraded to offer fairly extensive scriptability. This extends not only to GUI objects as under MacApp, but also to data objects inside them, including text, tables and various list objects. A text file is used to map the internal "object-like" names onto human-readable versions, and in most cases creating this is all that is needed to add fairly substantial scriptability to most programs.

While Cocoa applications are not AEOM based, and often use subtly different objects than Apple's originally defined standard objects, Cocoa apps are generally much more scriptable than their "classic" counterparts—in fact, it is uncommon to find a Cocoa application that is not scriptable to some degree.

Scripting Bridge

[edit]

The Scripting Bridge is a macOS framework which allows applications to communicate with each other without the use of an intermediary scripting language such as AppleScript. Like AppleScript, the Scripting Bridge uses Apple events for inter-application communication.[1]

The Scripting Bridge is typically used from Objective-C,[1] but can be used in other programming languages through an Objective-C bridge such as MacRuby[2] and PyObjC.

Further reading

[edit]
  • Cook, William R. (September 29, 2006), "AppleScript" (PDF), Proceedings of the third ACM SIGPLAN conference on History of programming languages, University of Texas at Austin, pp. 1–1–1–21, CiteSeerX 10.1.1.76.6993, doi:10.1145/1238844.1238845, ISBN 9781595937667, S2CID 220938191, retrieved May 9, 2009{{citation}}: CS1 maint: location missing publisher (link). In particular, see Section 2.3 “Apple Events” (pages 9–13), though the history and importance of Apple Events is also discussed elsewhere in the paper.

References

[edit]
  1. ^ a b "Scripting Bridge". Apple Developer documentation. Retrieved 2025-08-07.
  2. ^ Paul, Ryan (2025-08-07). "Tutorial: OS X automation with MacRuby and the Scripting Bridge". Ars Technica. Retrieved 2025-08-07.
[edit]
什么什么入胜 鸟吃什么东西 乳头痒用什么药 办理护照需要什么手续 肛门疼痛是什么原因引起的
献血有什么坏处 尿道口有烧灼感为什么 恶心想吐是什么原因 阁老相当于现在什么官 火热是什么意思
看脑血管挂什么科 舌苔厚发黄是什么原因 丁克夫妻是什么意思 大便陶土色是什么颜色 送男教师什么礼物合适
卡卡西为什么要杀琳 血小板减少有什么症状 黄眉大王是什么妖怪 鲤鱼最爱吃什么食物 itp是什么病的简称
宝宝dha什么时候吃最好xjhesheng.com 近视眼睛什么牌子好hcv8jop7ns9r.cn 热感冒吃什么食物好hcv8jop3ns9r.cn 吃红薯有什么好处hcv8jop0ns2r.cn 咀嚼是什么意思hcv9jop2ns3r.cn
男人为什么喜欢女人hcv9jop0ns0r.cn 浮沉是什么意思hcv7jop4ns8r.cn 什么手组词hcv9jop4ns9r.cn 缺钾吃什么补beikeqingting.com 嬉皮笑脸是什么生肖hcv9jop3ns3r.cn
十月二十二什么星座helloaicloud.com 明朝前面是什么朝代hcv8jop1ns3r.cn abo是什么意思dayuxmw.com 产妇吃什么鸡最好hcv9jop6ns4r.cn 什么药通便最快hcv9jop7ns1r.cn
什么叫低级别上皮内瘤变wmyky.com psa是什么意思gysmod.com sp是什么hcv8jop2ns1r.cn 女人要的是什么hcv8jop6ns6r.cn 什么是阴茎hcv9jop7ns4r.cn
百度