O
O
Oleg Dyachenko2014-02-27 15:34:09
Automation
Oleg Dyachenko, 2014-02-27 15:34:09

How to implement pulling links from Mail 7.1 OS X Mavericks?

Hello.
I work for MacBook Air 2012 (mid). OS X Mavericks. Version Mail 7.1
From the mailbox I receive mail, which is scattered by category. Text and links inside emails. It is required to pull out links from some categories, from all letters (for example, only from new letters), compare them for duplicates, and then open them in the browser.
I would really like the program to do it for me.
If necessary, I am ready to learn and write an algorithm of work myself, but I have no idea at all by what means this can be implemented.
If you know how, or with what, you can do this, please share.
I hope I described what is required clearly enough, if there are any shortcomings, let me know, I will correct it.
Thanks in advance.
PS Is it true that all OS X programs are written in Objective-C?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pavel Shvedov, 2014-02-27
@mmmaaak

Python: POPlib for working with mail, Python Regualr Expression for pulling links from emails, Python webbrowser for opening links in a browser... I think this should be enough for a start, a small python script, I think, will cope with such a task

A
An, 2014-02-27
@Flanker_4

There is such a tool in Mac OS - Automator. With it, it seems to me that it is not difficult to do it, basically you will have to program with the mouse
stackoverflow.com/questions/17970080/how-to-get-ma...
Here is an example of receiving a letter from a mail app.

E
Evgeny Petrov, 2015-05-26
@Petroveg

3 part of the ballet

$blocks.each(function () {
  //Проходим по всем элементам с классом .block
  var $this = $(this),
    //Понятно, создали JQ-объект и сохранили ссылку
    id = $this.find('.id').html(),
    // Получили содержание элемента с классом .id в этом контексте
    date = $this.find('.date').html(),
    // То же самое для класса .date
    value = $this.find('.value').html();
    // И для класса .value

  // Задача — для всех одинаковых значений id объединить поля с датой
  results[id] = results[id] || {};
  // В свойстве с именем по значению id уже есть объект, или мы его только что создали
  // Задача — для всех одинаковых дат в объекте с одинаковым id получить сумму
  results[id][date] = results[id][date] || 0;
  // В свойстве с именем по значению date уже есть число, или пишем в него 0
  results[id][date] += parseInt(value);
  // И добавили целое, полученное из value
});
// Обход элементов завершён

$.each(results, function (id, dates) {
  // Обходим объект results, в каждой итерации получаем название свойства и его значение
  $.each(dates, function (date, value) {
    // А тут получаем название свойства, сформированное из даты, и его значение
    // В замыкании есть всё, что нужно — id, date, value
  });
});

To process a new field, you need to slightly modify the structure of the object and its processing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question