Solved

How do I add an attachment to a Notes Memo using Applescript?

Posted on 2004-10-01
8
416 Views
Last Modified: 2013-12-18
How do I add an attachment to a Notes Memo using Applescript?
I have an applescript that automatically creates and sends an email but I really need to auto add an attachment.
Mac OSX
Lotus Notes Client 6.5.1
0
Comment
Question by:intouchsystems
8 Comments
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12201431
AppleScript ????  Cool :-)

Show us the script you have now, then we may be able to help

cheers,

Tom
0
 

Author Comment

by:intouchsystems
ID: 12201470
tell application "Finder"
      activate
      display dialog "Choose a file to attach"
      set somefile to choose file with prompt "Choose a file to attach…"
      set target2 to name of somefile
      set path1 to POSIX path of somefile
end tell
set attach1 to target2
property ToAddress : "systems@intouchplc.com"
property CCAddress : "systems@intouchplc.com"

tell application "Notes"
      set myDB to make new database with data {"", ""}
      try
            openmail myDB
      end try
      
      set myDoc to make new document with data {myDB}
      replaceitemvalue myDoc itemname "SendTo" newvalue ToAddress
      replaceitemvalue myDoc itemname "Subject" newvalue "Is there an attachment?"
      replaceitemvalue myDoc itemname "Body" newvalue "Yes :-), No :-("
      replaceitemvalue myDoc itemname "CopyTo" newvalue CCAddress
      send myDoc without attachform
end tell
0
 
LVL 14

Accepted Solution

by:
p_partha earned 250 total points
ID: 12201488
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 250 total points
ID: 12229253
    replaceitemvalue myDoc itemname "Subject" newvalue "Is there an attachment?"
     replaceitemvalue myDoc itemname "Body" newvalue "Yes :-), No :-("
     replaceitemvalue myDoc itemname "CopyTo" newvalue CCAddress
     send myDoc without attachform

change to

     replaceitemvalue myDoc itemname "Subject" newvalue "Is there an attachment?"
     set myBody to make new richtextitem with data {myDoc,"Body"}
     appendtext myBody newvalue newvalue "Yes :-), No :-("
     embedobject myBody with data { 1454 , "" , attach1 }
     replaceitemvalue myDoc itemname "CopyTo" newvalue CCAddress
     send myDoc without attachform

Now, I don't know AppleScript, but based on the syntax you used, I attempted to piece it together.

The call
    set myDoc to make new document with data {myDB}
Is equivalent to LotusScript
    set myDoc = New NotesDocument ( myDB )
I thus reversed
    Set myBody = New NotesRichTextItem ( myDoc , "Body" )
Into AppleScript
    set myBody to make new richtextitem with data {mydoc,"Body"}

Hopefully, I similarly got
    replaceitemvalue myDoc itemname "SendTo" newvalue ToAddress
As being LotusScript
    myDoc.replaceItemValue "SendTo" , ToAddress
Although the newvalue bit threw me, since Lotus help and mappings just call it "value."

The EMbedObect might notbe correct.  I assumed that With Data works across all calls, not just instalntiation, so that you don't have to name all the parameters.  If not, the following might work:
     embedobject myBody type 1454 class "" source attach1
Or
     embedobject myBody type 1454 class "" source attach1 name ""
Or
     embedobject myBody type 1454 class "" source attach1 name NULL
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 12710375
I don't know that I actaully SOLVED the problem, but I'm pretty sure there was enough info there to get the problem solved, or to take the next round of comments deeper toward a complete soultion.

Partha similarly pointed at a long script that contained some similar functions.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
LOtus Notes 6.5 low performance 13 36
Lotus notes "Estimate" form to Quickbooks invoice 2 355
Domino Server 11 67
Lotus Notes Database - Include button in Email Notification 8 62
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question