如何操作“数据"AppleScript 中的对象 [英] How to manipulate "data" objects in AppleScript

查看:24
本文介绍了如何操作“数据"AppleScript 中的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 AppleScript 使用 iTunes.轨道的 artwork 元素包含图像 data(或 raw data,在实践中出现返回相同的东西),可以检索并且,比如说,直接写入文件.(这是一个例如 PNG 字节流.)

I'm working with iTunes via AppleScript. The artwork element of a track contains image data (or raw data, which appears in practice to return the same thing), which can be retrieved and, say, directly written to a file. (It's an e.g. PNG bytestream.)

但是我不知道除了将它写入文件之外如何处理这个东西.我想问它包含多少字节,或者甚至翻遍它(尽管后者很可能超出 AppleScript 的范围).在 Script Debugger 中,它看起来像 «data tdtaXXXXXX.....» (我编写 XXX 的十六进制值),并且 iTunes 脚本字典没有链接到任何有用的类型/类.

But I don't know how to do anything with this thing besides write it to a file. I'd like to ask it how many bytes it contains, or even rummage through it (though the latter may well be out of scope for AppleScript). In Script Debugger, it looks like «data tdtaXXXXXX.....» (hex values where I wrote the XXXs), and the iTunes scripting dictionary doesn't link through to any useful type/class for it.

我不太确定 AppleScript 中的 guillemets 是什么意思,或者这个对象的性质是什么,或者这个东西是否可以被本地询问.任何有关这方面的参考资料都会有所帮助.谢谢!

I'm not really sure what the guillemets mean in AppleScript, or what the nature of this object is, or whether this thing can be interrogated natively. Any references on this would be helpful. Thanks!

推荐答案

参见 https://books.google.com/books?id=rW5k0w_wC3MC&pg=PA57&lpg=PA57&dq=guillemets+applescript+events+data&source=bl&ots=ogzi9W4jxW&sig=7ct-n0wpzdhBhtHDJtTrZDKgEEk&hl=en&sa=X&ei=-qSYVICZAsjooASo0oKwCg&ved=0CB4Q6AEwAA#v=onepage%2famp;events=onepage%2filles&eventaAppleScript 中原始代码和数据的解释以及 guillemets 的使用;看到这个答案:

See https://books.google.com/books?id=rW5k0w_wC3MC&pg=PA57&lpg=PA57&dq=guillemets+applescript+events+data&source=bl&ots=ogzi9W4jxW&sig=7ct-n0wpzdhBhtHDJtTrZDKgEEk&hl=en&sa=X&ei=-qSYVICZAsjooASo0oKwCg&ved=0CB4Q6AEwAA#v=onepage&q=guillemets%20applescript%20events%20data&f=false for explanation of raw codes and data and use of guillemets in AppleScript; See this answer:

从 Applescript 中的当前曲目获取艺术作品

将图像数据从 iTunes 艺术作品写入文件的示例.

for an example of writing image data from iTunes artwork to file.

这篇关于如何操作“数据"AppleScript 中的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆