Marketcircle    Forums  Hop To Forum Categories  Daylite  Hop To Forums  Share Zone    Emailing organizations
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Apprentice
Posted
I have been struggling for ages trying to send bulk emails to an organization. I ended up writing this fScript to do it. Its my first time making one of these so it is probably not the best way. Feel free to modify it and make it better. I was thinking it would be good if it cycled through the contacts associated with that organization first, getting their email addresses, and then if you dont have a contact, or a contacts email address, it returns the organizations email address.

To use just copy and paste into AppleScript. Select the organizations you want to export in daylite. Hit run and it will generate a text file on the desktop called 'organizations.txt'

*********

tell application "Daylite"
set obj_val_list to eval "
s := NSString string.

document := (NSApplication sharedApplication) firstDayliteDocument.

objects := (document firstMainWindowController) selectedObjects.

start := 0.
total := objects count.

[start < total] whileTrue:
[

object := objects at:start.

val := (object valueForKeyPath:'contacts').

val == nil ifTrue:
[
\"add an empty string as a place holder\"
s := s ++ ''.
]
ifFalse:
[
s := s ++ ((val count) stringValue).
s := s ++ '; '.
].

val := (object valueForKeyPath:'name').

val == nil ifTrue:
[
\"add an empty string as a place holder\"
s := s ++ ''.
]
ifFalse:
[
s := s ++ val.
s := s ++ '; '.
val := (object valueForKeyPath:'electronicAddresses.typeString').
totalemailadded := 0.
starta := 0.
totala := val count.
[starta < totala] whileTrue:
[
vala := (val at:starta).
vala = 'Email' ifTrue:
[
valb := (object valueForKeyPath:'electronicAddresses.url').
valc := (valb at:starta).
s := s ++ (valc).
s := s ++ '; '.
totalemailadded := totalemailadded + 1.
].
starta := starta + 1.
].
].



s:= s ++ '
'.

start := start+ 1.
].
s writeToFilefrowne('~/Desktop/Organizations.txt') stringByExpandingTildeInPath) atomically:true.
"

end tell

display dialog obj_val_list as string buttons {"OK"}
 
Posts: 2 | Location: New Zealand | Registered: January 16, 2007Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
Watch out for that sad face after writeToFile at the bottom, it should be : ( without the space
 
Posts: 2 | Location: New Zealand | Registered: January 16, 2007Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

Marketcircle    Forums  Hop To Forum Categories  Daylite  Hop To Forums  Share Zone    Emailing organizations

© Copyright 2006 Marketcircle Inc. All rights reserved.