Mailsmith
Other Programs
Scripts
Mailsmith.scpt
Archive to sub-mailbox
Check Spelling
Find reply
Change font size
Submit Script to JEM
Fix common spelling errors
Setting SMTP server
URL from Safari
Address from AB
linkMunge
Export to Address Book
Saving attachments
Digest Script
File with same
POP window position
Position of new windows
iCal and Mailsmith
Edit From Line
Modified Thread Script
Reply to Selection
Temporary Text Window
Compact gain
Tracking backups
Edit subject
Googler
Auto-rewrap
MMA
SMTP server
Open, fetch, and close
URL Manager
BrainForest
Thread by Author
Thread by subject
Export Email
Get Selection
Read Addresses
Export Email
Organize Email
Account setup
Mailsmith 2 BBEdit
BBEdit 2 Mailsmith
Search II
Check One
Delete Enclosure
Open, fetch, close
Set Answered
Set Redirected
Empty Trash
List found
Print Several
Del. old. msg.
Delete Enclosures
Accounts
Address Book
Editing
Filters
General
Import/Export
Links
Mailboxes
Memory
Scripting
Speed
send/receive
Tips/Tricks


Export to URL Manager Pro

Author Jan Erik Moström
Last modified 2001-03-26
What is this?

Note: I haven't tested it much

The purpose of this script is to export addresses from Mailsmith to URL Manager Pro. You can select one or more messages, mailboxes, persons or groups and then use this script to export the addresses to URL Manager Pro.

When you run the script, this window is shown (you can comment away it in the code if you like):

urlmanopt

Select the stuff you want to export and click OK. The addresses will be sent to URL Manager Pro.

Installation If you want to see the dialog you have to install Dialog Director before using the script. Compile the script and install it in the Mailsmith Scripts folder. That's it.


property pDialogFonts : [{name:"Geneva", size:9, style:plain}, {name:"Geneva", size:9, style:bold}]
property pExportGroups : true
property pExportNotes : true
property pExportTo : false
property pExportCC : false

on run
  tell application "Mailsmith 1.1"
    set curSel to selection
    if class of curSel ≠ list then
      set curSel to curSel as list
    end if
    
    -- If you don't want to use Dialog Director, comment out
    -- the line below
    my getWhatToExport()
    
    try
      set className to class of item 1 of curSel
    on error
      set className to ""
    end try
    if className = mailbox then
      set noi to the number of items of curSel
      repeat with i from 1 to noi
        my exportMessageNames(messages of item i of curSel)
      end repeat
    else if className = message then
      my exportMessageNames(curSel)
    else if className = string then
      my exportThisSender(message of window 1)
    else if className = person or className = group then
      set noi to the number of items of curSel
      repeat with i from 1 to noi
        set ci to item i of curSel
        if class of ci = person then
          exportPerson(ci)
        else if pExportGroups then
          set pl to items of ci
          set noi to the number of items of pl
          repeat with i from 1 to noi
            set ci to item i of pl
            set t to original item of ci
            my exportPerson(t)
          end repeat
        end if
      end repeat
    end if
  end tell
end run

on exportPerson(ci)
  tell application "Mailsmith 1.1"
    set adrName to name of ci
    set adrEmail to url of ci
    if pExportNotes then
      set adrNote to notes of ci
    else
      set adrNote to ""
    end if
    tell application "URL Manager Pro™"
      savebookmark adrEmail name adrName info adrNote
    end tell
  end tell
end exportPerson

on exportMessageNames(msgList)
  set noi to the number of items of msgList
  repeat with i from 1 to noi
    exportMessage(item i of msgList)
  end repeat
end exportMessageNames

on exportMessage(msg)
  tell application "Mailsmith 1.1"
    if pExportNotes then
      set exp_note to notes of msg
    else
      set exp_note to ""
    end if
    my saveAddressToURLMP(originator of msg, exp_note)
    if pExportTo then
      set adrTo to to_recipients of msg
      set noi to the number of items of adrTo
      repeat with i from 1 to noi
        my saveAddressToURLMP(item i of adrTo, exp_note)
      end repeat
    end if
    if pExportCC then
      set adrCC to cc_recipients of msg
      set noi to the number of items of adrCC
      repeat with i from 1 to noi
        my saveAddressToURLMP(item i of adrCC, exp_note)
      end repeat
    end if
  end tell
end exportMessage

on saveAddressToURLMP(x, n)
  tell application "Mailsmith 1.1"
    set exp_name to display name of x as string
    set exp_email to url of x as string
    tell application "URL Manager Pro™"
      savebookmark exp_email name exp_name info x
    end tell
  end tell
end saveAddressToURLMP


on getWhatToExport()
  set theDialog to {size:{400, 100}, style:movable dialog, closeable:true, name:"Export", default item:2, contents:{¬
    {class:static text, bounds:{7, 0, 127, 100}, contents:"What should be exported:"}, ¬
    {class:push button, bounds:{324, 75, 394, 95}, name:"OK"}, ¬
    {class:check box, bounds:{139, 67, 224, 82}, name:"Groups", value:pExportGroups}, ¬
    {class:check box, bounds:{139, 50, 224, 66}, name:"Notes", value:pExportNotes}, ¬
    {class:check box, bounds:{139, 5, 250, 21}, name:"To addresses", value:pExportTo}, ¬
    {class:check box, bounds:{139, 22, 250, 38}, name:"CC addresses", value:pExportCC} ¬
      }}
  set res to dd auto dialog theDialog with fonts pDialogFonts with grayscale
  set pExportGroups to item 3 of res
  set pExportNotes to item 4 of res
  set pExportTo to item 5 of res
  set pExportCC to item 6 of res
end getWhatToExport