简体   繁体   English

从Objective-C创建Web归档文件

[英]Creating a webarchive from objective-c

We are updating our email signatures in the company I work for and since the last update a lot of our employees have swithes to Mac. 我们正在为我工​​作的公司更新电子邮件签名,自上次更新以来,我们的许多员工都对Mac有所了解。 Allthough they have switched, few are techincal experts. 尽管他们已经转换,但很少有技术专家。

Many of our users use the Mail app in OSX. 我们的许多用户在OSX中使用Mail应用程序。 To install a HTML signature in the Mail app it quite an hassle which I would like to improve for these users. 在Mail应用程序中安装HTML签名非常麻烦,我想为这些用户改进。 What I want to do is to create an OSX app that uses an build in template and filles that template with the users name, job title, phone number ect. 我要做的是创建一个OSX应用程序,该应用程序使用内置模板并用用户名,职称,电话号码等填充该模板。 BUT, now the "hard" part comes... how can I make a webarchive from the HTML page that is the result of the template? 但是,现在“困难”部分来了...我如何才能从模板结果的HTML页面创建Web归档? And also, can I programaticly add this to Mail? 而且,我可以以编程方式将其添加到Mail吗?

Best regards, 最好的祝福,
Paul Peelen 保罗·皮伦

Creating .webarchive is easy. 创建.webarchive很容易。 Use the command line tool textutil , or use WebView 's method [[[webView mainFrame] dataSource] webArchive] to get it. 使用命令行工具textutil ,或使用WebView的方法[[[webView mainFrame] dataSource] webArchive]进行获取。

You can change the signatures stored in Mail.app via Applescript. 您可以通过Applescript更改Mail.app中存储的签名。 See its dictionary using AppleScript Editor.app. 使用AppleScript Editor.app查看其字典。 It accepts a rich text as an argument, so you might want not the webarchive but a rich text. 它接受富文本格式作为参数,因此您可能不需要Web存档,而需要富文本格式。

You can also look at my Applescripts on Mail signatures - hints.macworld.com that a wrote a while ago. 您还可以查看我在邮件签名上的Applescripts-前一阵子写的hints.macworld.com Which may be of some help. 这可能会有帮助。 They use Textutil to import and export Mail signatures. 他们使用Textutil导入和导出邮件签名。

Also have a look at Preferences Utilities Reference which may help you to update the SignaturesByAccount.plist in Objective C. 还可以查看“首选项实用程序参考” ,它可以帮助您更新Objective C中的SignaturesByAccount.plist。

And the value Types section of Accessibility Roles and Attributes Reference to get an idea of the the abstract value types, and their specific C and Objective-C types. 通过“ 辅助功能和属性参考 ”的“值类型”部分可以了解抽象值类型及其特定的C和Objective-C类型。 Ie NSArray = CFArrayRef. 即NSArray = CFArrayRef。 You will need those for the plist. 您将需要这些用于plist。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM