Solved

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

Posted on 2004-10-01
8
425 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 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