简体   繁体   中英

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. Allthough they have switched, few are techincal experts.

Many of our users use the Mail app in OSX. To install a HTML signature in the Mail app it quite an hassle which I would like to improve for these users. 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. BUT, now the "hard" part comes... how can I make a webarchive from the HTML page that is the result of the template? And also, can I programaticly add this to Mail?

Best regards,
Paul Peelen

Creating .webarchive is easy. Use the command line tool textutil , or use WebView 's method [[[webView mainFrame] dataSource] webArchive] to get it.

You can change the signatures stored in Mail.app via Applescript. See its dictionary using AppleScript Editor.app. It accepts a rich text as an argument, so you might want not the webarchive but a rich text.

You can also look at my Applescripts on Mail signatures - hints.macworld.com that a wrote a while ago. Which may be of some help. They use Textutil to import and export Mail signatures.

Also have a look at Preferences Utilities Reference which may help you to update the SignaturesByAccount.plist in Objective C.

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. Ie NSArray = CFArrayRef. You will need those for the plist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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