Solved

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

Posted on 2004-10-01
8
420 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 Views display column from text field in computed subform. 4 332
Lotus notes email code 2 126
Domino Server 11 72
Lotus Domino server 9 7 81
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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