• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AW: Apple Mail Date Remote & Local and IP Lookup
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: Apple Mail Date Remote & Local and IP Lookup


  • Subject: AW: Apple Mail Date Remote & Local and IP Lookup
  • From: "Schmidt, Michael" <email@hidden>
  • Date: Sat, 22 Sep 2012 10:22:47 +0200
  • Acceptlanguage: de-DE
  • Thread-topic: Apple Mail Date Remote & Local and IP Lookup



Gesendet von meinem Windows Mobile-Telefon


Von: Christopher Stone <email@hidden>
Gesendet: Freitag, 21. September 2012 21:00
An: Applescript Users List <email@hidden>
Betreff: Apple Mail Date Remote & Local and IP Lookup

Hey Folks,

Just messing around here.

I have a script to display the Unix date/time of a message, and I expanded this to show both the local and remote dates.

I also am fiddling around with an IP lookup of the sender.

Parts 1 & 2 are independent of each other but dependent upon the previous code.

Question:

Does anyone know of a better IP lookup service?

Thanks.

--
Chris

------------------------------------------------------------------------------------------------
tell application "Mail"
  set msg to item 1 of (get selection)
  tell msg
    set AppleScript's text item delimiters to {linefeed & linefeed}
    set srcHdrs to text item 1 of (get source)
    set allHdrs to (get all headers)
  end tell
end tell

# Part 1
set dtHdrs to (do shell script "sed -En 's/^Date: *(.+)/\\1/p' <<< " & quoted form of (srcHdrs & return & allHdrs) without altering line endings)
set senderDate to paragraph 1 of dtHdrs
set localDate to paragraph 2 of dtHdrs
set localDate to do shell script "date -jf \"%B %d, %Y %H:%M:%S\" " & "\"" & localDate & "\" \"+%a, %e %b %Y %H:%M:%S %z %Z\""
set dList to {"--------------------------------", senderDate, localDate, "--------------------------------"}

choose from list dList with title "Date Strings from Mail" with prompt ¬
  "TOP: Sender" & return & "BOT: Local" with multiple selections allowed and empty selection allowed


# Part 2
set ipAdrs to do shell script "awk -F[ '/^Received:/ { print }' <<< " & (quoted form of allHdrs) & " \\
  | awk '/\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\]/ { print }' \\
  | sed -En 's/.*\\[([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})\\].*/\\1/gp' \\
  | awk 'END{print}' "

set _url to "http://www.botsvsbrowsers.com/ip/" & ipAdrs & "/index.html"

tell application "Safari"
  activate
  make new document with properties {URL:_url}
end tell
------------------------------------------------------------------------------------------------

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Safari Tab Name & Url Backup
  • Next by Date: Safari Bookmarks
  • Previous by thread: Safari Tab Name & Url Backup
  • Next by thread: Safari Bookmarks
  • Index(es):
    • Date
    • Thread