"There’s nothing in the middle of
the road but yellow stripes and dead armadillos."
Jim Hightower
Showing posts with label Apple. Show all posts
Showing posts with label Apple. Show all posts

Sunday, 22 October 2017

Saving PDFs from Apple Mail

I should have remembered how easy Apple makes things rather than starting off on a more complicated path.

I have a number of email invoices from an online shop that I want to store locally. I know that Spotlight indexes the email and I should be able to easily find these invoices going forward, but wanted to group the invoices with some other files - scanned receipts and documents.

I had been able to use the Mail option 'File | Save as a PDF' on each message, but there were 100 or so messages and I thought this would be tedious and spent a day investigating Automator and Applescript.

Long-story short, I had assumed (... breaking rule #1) that Mail would aggregate all the message if I tried to save more than one. It doesn't - just saves out each file as a PDF in turn.

So the easy solution is to save the file to a folder and then get Hazel to rename, tag and sort the files from there.

Saturday, 31 August 2013

Using Applescript in an Apple Mail rule

Just spent a few hours trying to figure out how to correctly fire a script from a Mail rule.

I was originally using this syntax from here as it seemed to be posted most places and used the handler construction that is similar to the one used by Hazel, but couldn't get the script to work.

on perform_mail_action(theData)
   tell application "Mail"
      set theSelectedMessages to |SelectedMessages| of theData
      set theRule to |Rule| of theData
      repeat with a from 1 to count theSelectedMessages
         — Process the current message
      end repeat
   end tell
end perform_mail_action

I eventually found this page with the following syntax that works perfectly - I should have known that Apple would provide an example script!

For reference "/Library/Scripts/Mail Scripts/Rule Actions/Sample Rule Action Script.scpt." is repeated here:

(*
Sample Rule Action Script
Copyright © 2003–2013 Apple Inc. All rights reserved.
You may incorporate this Apple sample code into your program(s) without
restriction.  This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours.  You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes.  If you're going to redistribute the code, we require that
you make it clear that the code was descended from Apple sample code,
but that you've made changes.
*)
(*
This script is an example of how to write an AppleScript that can be
attached as a rule action. See Mail Help for details and Mail's 
AppleScript dictionary for the full terminology for the 'perform mail
action with messages' handler.
If you attach this script to a rule action, and the rule
matches an incoming message, a dialog box will display, showing
the name of the rule that matched and the subject of the message
that matched. One dialog per matched message will appear.
This is also an example of how you can write scripts that appear in the
Scripts menu and can pass in parameters for the selected messages and/or
mailboxes in Mail's main viewer window.
*)
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
set theText to "This AppleScript is intended to be used as an AppleScript rule action, but is also an example of how to write scripts that act on a selection of messages or mailboxes." & return & return & "To view this script, hold down the option key and select it again from the Scripts menu."
repeat with eachMessage in theMessages
set theSubject to subject of eachMessage
try
-- If this is not being executed as a rule action,
-- getting the name of theRule variable will fail.
set theRuleName to name of theRule
set theText to "The rule named '" & theRuleName & "' matched this message:"
set theText to theText & return & return & "Subject: " & theSubject
display dialog theText
set theText to ""
end try
end repeat
if theText is not equal to "" then
display dialog theText buttons {"OK"} default button 1
end if
end tell
end perform mail action with messages
end using terms from

Tuesday, 24 January 2012

Transferring Photos From An iPhone To Your Mac Wirelessly

I had some pictures on my iPhone that I wanted to copy to my work laptop, but had to get them on my MacBook to start with.

Plan A was to wirelessly sync my iPhone with the Mac and then email the files to my work account.

However, the Camera Roll on the iPhone is not synchronised with the Mac or iPhoto by default. You can use Photo Stream, but that locks the pictures in and doesn't allow you to delete the images easily.

There are several apps on the App Store that allow you to sync with DropBox, but it seems that the DropBox application does it natively for you, so I save my £1.99 and did it the free way!

Wednesday, 30 November 2011

Moshi Monsters and Apple's Parental Controls

I have a 8 year old that wants to access the Moshi Monsters site using Safari from a desktop locked down with parental controls on an OS X Lion Server.

Moshi Monsters seems to be predominantly a Flash based site that causes the parental controls software some problems. Several other people have found the same problem.

When we first tried to access the site, it was properly blocked and asked for permission. Once it had been added to the list of allowed sites, I thought it would all work.

However, once you log in to your pet, it gets locked at the "Loading" screen, but there isn't any further warning from the parental controls software.

If you look at the source code for the page, it is trying to load information from c.mmcdn.net and I wondered if this was causing the site to be blocked.

I thought if I added this as a bookmark, then the page would load correctly, but it didn't... After a bit of head scratching, I ran nslookup for 'c.mmcdn.net' from a Terminal window and it returned the following alias entries:

> c.mmcdn.net
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
c.mmcdn.net canonical name = c.mindcandy.cotcdb.net.
c.mindcandy.cotcdb.net canonical name = orig-10005.mindcandy.cotcdn.net.
Name: orig-10005.mindcandy.cotcdn.net
Address: 94.127.74.140
Once I added 'c.mindcandy.cotcdb.net' and 'orig-10005.mindcandy.cotcdn.net' to the list of bookmarks, the page loaded correctly.

I doubt this is a permanent fix as the Moshi Monster site may change its hosts, but at least it is a temporary work-around!

Wednesday, 8 September 2010

iTunes VAT receipts

If you’re a VAT registered business using the iPad and/or iPhone and are purchasing applications for business use or as part of your application development research, you’ll probably want a VAT receipt from Apple and will have noticed that all the receipts provided clearly state that ‘… this is _not_ a VAT receipt…”

In which case, you may be interested in the following article that describes how Jeremy Richards was able to obtain VAT receipts.

[Update 09/09/2010 – 10:00]

Received 2 VAT invoices this morning – out of a backlog of 8, along with an email stating:

Greetings from iTunes Store Customer Support. I understand that you wish to have a VAT invoices for your purchases. I can certainly see your concern. My name is Srinivas and I will do my best to provide you an appropriate information.

I would like to inform you that, the iTunes Store sells only to customers as end-users for personal, noncommercial use in their respective countries of residence. For more information, you can review the iTunes Store Terms and Conditions:

http://www.apple.com/legal/itunes/ww

Thank you for being an iTunes Store customer. Apple appreciates your business and understanding in this regard.

Regards,

Srinivas

iTunes Store Customer Support

I have replied using Jeremy’s erudite response template …

Dear Srinivas

Many thanks for your reply. Whilst I understand that your terms state that the applications are for personal use I would like to draw your attention to the Apple website that refers to business applications on many occasions. Just look at all these applications on offer. This part is on the iPhone tab 'With iPhone, you get secure corporate network connectivity, access to thousands of business apps, and tool for developing your own company apps.' Are you really telling me that you are selling people apps that they are not allowed to use?

It is irrelevant whether I wish to use my purchase for personal of business benefit. I am a VAT registered individual and I am requesting a VAT invoice. By UK law you have to supply me with one. Please see the [tax office website] for confirmation.

I note that you have already sent me VAT invoices for transaction IDs:

<Invoices Received>

I am currently missing VAT invoices for:

<Invoices Missing>

I look forward to receiving them, etc…

There’s also a similar experience posted here.

[Update 09/09/2010 – 16:00]

All missing VAT receipts received…