2015-12-08 2 views
0

Звучит странно, но у меня есть документ с текстом mac, который я просматриваю в веб-браузере в Safari и использую Safari «share> email this page», чтобы получить весь html-контент в электронном письме. У меня уже есть скрипт, который берет адреса электронной почты от excel по одному и вставляет его в получателей и вставляет тему. Я просто не могу понять команды applescript для отправки активной страницы сафари в почтовую почту mac. Извините, если это слишком сложно.Использовать applescript с сафари для отправки контента по почте

Ваша помощь очень уважаемые

Приветствия Роб

set {firstName, eAddress} to getData() 

repeat with i from 1 to count firstName 
tell application "Mail" 
    activate 
    set mymail to make new outgoing message at the beginning of outgoing messages with properties {subject:"Your Complimentary Chocolate Recipe Book"} 
    tell mymail 
     make new to recipient at beginning of to recipients with properties {address:item i of eAddress} 


    end tell 
    --show message window (otherwise it's hidden) 
    set visible of mymail to true 
    --bring Mail to front 
    activate 
    send mymail 
    set m to random number from 45 to 300 
    delay m 
end tell 
end repeat 


on getData() 
set colA to {} 
set colB to {} 
tell application "Microsoft Excel" 
    activate 
    tell active sheet 
     set lastRow to first row index of (get end (last cell of column 1) direction toward the top) 

     repeat with i from 3 to lastRow 
      set end of colA to (value of range ("A" & i)) 
      set end of colB to (value of range ("B" & i)) 
     end repeat 
    end tell 
end tell 

return {colA, colB} 
end getData 

ответ

0

Роб,

Если вы хотите, чтобы получить исходный HTML:

on get_page_data() 
    tell application "Safari" 
    return source of document of windows whose visible is true 
    end tell 
end 

Вы можете затем установить свойство содержимого исходящего сообщения от вашего make new строка в вашем коде:

tell application "Mail" 
    set mymail to make new outgoing message at the beginning of outgoing messages with properties {subject:"Your Complimentary Chocolate Recipe Book", content: get_page_data()} 
-- etc 
end tell 
+0

Извините за долгую задержку. большое спасибо! – Rob

Смежные вопросы