AppleScript: Add a HTML file in the body of Email by the clipboard

I would like to insert a HTML file into the body of Email by the clipboard action.
This is my cord below:
set the clipboard to (read (choose file) as «class RTF »)
set theBody to "Hello"
tell application "Mail"
activate
  set theMessage to make new outgoing message with properties {content:theBody, visible:true, subject:"mysubject"}
end tell
tell application "System Events"
  tell process "Mail"
  set focused of UI element 1 of scroll area 1 of window 1 to true
  keystroke "v" using command down
  end tell
end tell
This code enables only rtf file rather than HTML.
Also I don't want to use the html content by the function of Mail.
Because if using it, you won't insert both  a html file and body at the same time.
So what I would like to is to insert a HTML file by the clipboard action into a body.
Thank you!

Hi,
One solution is to use Safari to copy the document:
set x to choose file -- a HTML file
tell application "Safari"
    open x
    delay 2
    repeat while source of document 1 does not contain "</html>"
        delay 1.5
    end repeat
    activate
end tell
tell application "System Events"
    tell process "Safari"
        set frontmost to true
        keystroke "a" using command down -- select all
        delay 0.3
        keystroke "c" using command down -- copy to clipboard
    end tell
end tell
set theBody to "Hello"
tell application "Mail"
    activate
    set theMessage to make new outgoing message with properties {content:theBody, visible:true, subject:"mysubject"}
end tell
tell application "System Events"
    tell process "Mail"
        set focused of UI element 1 of scroll area 1 of window 1 to true
        keystroke "v" using command down
    end tell
end tell
Also try this:
set the clipboard to (read (choose file) as «class HTML») -- a HTML file

Similar Messages

  • How to add a html file into JEditorPane

    Hi
    I am doing an aplication on swing.But I don't know how to add a html file to the JeditorPane keeping the html file on the source code. i.e my html file is in my source code.Then how to add this html file to Jeditor pane.
    Thanks
    Srikant

    QuickTime requires player and plugins that most people don't have.  You'll reach a much wider audience if you use HTML5 <video> with mp4, webm and ogg files.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>HTML5 with Video</title>
    <!--help for older IE browsers-->
    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    </head>
    <style>
    video {
        max-width:100%;
        display:block;
        margin:0 auto;
    </style>
    <body>
    <h2>Use 3 File Types to support all browsers &amp; mobile devices:  MP4, WEBM and OGV.</h2>
    <h3>Online Video Converter
    http://video.online-convert.com/</h3>
    <!--begin video-->
    <video controls poster="Your_poster_image.jpg">
    <!--these are 6 sec sample videos for testing purposes. Replace sample-videos with your own files-->
    <source src="http://techslides.com/demos/sample-videos/small.webm" type="video/webm">
    <source src="http://techslides.com/demos/sample-videos/small.ogv" type="video/ogg">
    <source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">
    If you're seeing this, you're using an
    outdated browser that doesn't support
    the video tag. </video>
    <!--end video-->
    </body>
    </html>
    Nancy O.

  • AppleScript: Change an order of texts and HTML file in the body of Mail

    I would like to know how to insert a HTML file below the Signature in the body of Email.
    This is my code,,,,
    set the clipboard to (read (choose file) as «class RTF »)
    set theBody to "Hello"
    tell application "Mail"
    activate
      set theMessage to make new outgoing message with properties {content:theBody, visible:true, subject:"mysubject"}
    end tell
    tell application "System Events"
      tell process "Mail"
      set focused of UI element 1 of scroll area 1 of window 1 to true
      keystroke "v" using command down
      end tell
    end tell
    What I would like to do is an order of body going like
    From the top:
    Body
    Signature
    HTML rtf file
    Please teach me how to do!
    Cheers,

    Hi,
    murrayshimada wrote:
    Wondering how about inserting a HTML between body and signature? If you have a free time, please give me a tip again. Anyway, thank you for your help. Cheers,
    You can set the order like this:
    set the clipboard to (read (choose file) as «class RTF »)
    set theBody to "Hello" & return & return -- need two return character to paste the clipboard after the body
    tell application "Mail"
        activate
        set theMessage to make new outgoing message with properties {content:theBody, visible:true, subject:"mysubject"}
        my pasteToEnd()
        delay 0.6 -- need a delay to not remove the pasted text.
        set message signature of theMessage to signature 1 -- this put the signature after the text
    end tell
    on pasteToEnd()
        tell application "System Events"
            tell process "Mail"
                set focused of UI element 1 of scroll area 1 of window 1 to true
                key code 125 using command down -- (arrow down + command down) to set the insertion point to the end of text 
                keystroke "v" using command down
            end tell
        end tell
    end pasteToEnd
    Here's another example, the order =  the HTML, the body and the signature:
    set the clipboard to (read (choose file) as «class RTF »)
    set theBody to "Hello"
    tell application "Mail"
        activate
        set theMessage to make new outgoing message with properties {content:"theBody", visible:true, subject:"mysubject"}
        my pasteAtBeginning() -- at beginning
        delay 0.6 -- need a delay to not remove the pasted text.
        set message signature of theMessage to signature 1 -- this put the signature after the text
    end tell
    on pasteAtBeginning()
        tell application "System Events"
            tell process "Mail"
                set focused of UI element 1 of scroll area 1 of window 1 to true -- this set the insertion point at beginning
                keystroke "v" using command down
                keystroke return & return -- to put a blank line between the RTF and the body
            end tell
        end tell
    end pasteAtBeginning

  • Html file in the content of email.

    hi friends,
    I want to send email in the html format.
    can we pass the html file in the content of mail?
    i.e instead of doing this
    messageBodyPart.setContent("<html><body> " +
    "--------------------------------------------------------------------------------<br><br>"+
    ""+firstLine+"<br><br></body></html>" );
    can I directly pass the html file?
    Also if we have images in the html is there any way that instead of hot linking the images we can attach them with mail?

    Supplying the html content using a file instead of a String is easy:
    messageBodyPart.setDataHandler(new FileDataSource("file.html"));
    To include images in the message is harder, see the FAQ.

  • Is it possible to add a single file to the Favorites list in a finder window?

    I can add a folder, OK, but can't figure out how to add a single file to the favorites list. Is there a way?

    Never mind, I just found the answer in another post: hold down the command key

  • I want to put my old bookmarks onto my new computer. I tried the tutorial but it is looking for an html file not the jnos

    ''Duplicate post, continue here - [/questions/768056]''
    I made a backup file. I sent it to myself from another computer as an email. I can download it but can't open it when I chose import bookmarks. It's looking for a html format.

    What format did you back the bookmarks to?
    If it was a JSON file, use the restore process in the [[Backing up and restoring bookmarks]] article. If it was an HTML file follow the procedure in the [[Importing Bookmarks from an HTML File]] article.

  • How do i send an html file exported from muse as email blast with images and live links?

    My question it:
    How do i send an html file exported from muse as email blast with images and live links?
    I have designed a "website" in adobe muse and exported it as an html file. I am not sure how to send my .html file in an email!
    Best,
    Nicole

    Unfortunately, the answer is, you don't. The requirements for HTML displayed in an e-mail reader are very different than those for HTML displayed in a browser. The output of Muse won't work as an HTML e-mail. You could upload the Muse site as a website and provide a link to it in an e-mail, but the HTML generated by Muse is not suitable for direct display by an e-mail program.

  • Deployment of static html files (for the documentation of the application)

    I'm developing with forms 11g for windows and deploying on linux.
    I want to deploy the help docs of my application, which I've already migrated from hlp to html / css.
    Now, I would like to know where can I deploy that html files to invoke them with web.showdocument (for example).
    To what path is relative the url in the web.showdocument built in?
    Can I jar them as I did with the icons?

    ok, thanks anyway,
    Maybe the problem is with my weblogic configuration, as it is a windows developer workstation.
    I'll send instructions to the sysadmin and try to do it in the linux deployment server.
    I've tried also with WLExcludePathOrMimeType , as read in the manual this
    Note:
    When including any user-defined aliasMatch with the prefix /forms/ in forms.conf, add the directiveWLExcludePathOrMimeType. For example, in Linux, when defining the aliasMatch for /forms/usericons in forms.conf, the directive WLExcludePathOrMimeType is defined as following:
    AliasMatch /forms/usericons/(..*) "/home/userx/myicons/$1" WLExcludePathOrMimeType /forms/usericons/

  • Pubishing html file in the EP

    Does any body know, How can i present the html content of one file create in the KM with the html editor? what kind of iview can i use to publish the html?

    Hi Jose
    The KM Document iview can be used for displaying the document. In the properties of the iview change the path to the html file you created in the repository.
    Regards
    Geogi

  • How do I activate an HTML file from the tools menu?

    I understand how to add a custom entry to the TestStand 4.0 Sequence editor using the TOOLS->CUSTOMIZE... menu selection, but I want to:
    1) Activate an HTML page when the TOOLS menu option is selected
    and
    2) Provide the directory of the current sequence file to the HTML
    and
    3) Disable this new menu selection if the current sequence file has not been saved.

    Thanks for the clarification of your suggestion.  I have created a sequence with a single step: "Call Executable".  In the Executable Pathname field I have specified iexplorer.exe.  When I specify a specific HTML page in the Argument Expression field (i.e., "D:\Test.html") the sequence runs fine and properly activates IE showing the specified HTML file.  If I just specify a directory in the Argument Expression field (i.e., "D:\Foo\Bar") the sequence runs fine and properly activates IE showing the specified directory.
    However, when I put RunState.InitialSelection.SelectedFile.Path into the Argument Expression field, it doesn't show the directory.  Do I have to do something special in order to get RunState.InitialSelection.SelectedFile.Path properly interpreted when the sequence is executed?

  • Can i add a *jpeg file to the text analytic

    Post Author: Ferhat
    CA Forum: Performance Management and Dashboards
    can i add a jpeg file or something like that (*bmp, *gif) ?
    is anyone know?
    thanks a lot.

    Post Author: saravkumar
    CA Forum: Performance Management and Dashboards
    Yes, you can add an image.  Try the following html script with your image.name:
    <img src="http://technicalsupport.businessobjects.com/images/netscape.gif" width="33" height="32">
    or
    <img src="http://www.businessobjects.com/images/ie.gif">

  • How to run an applet(in a html file) in the server?

    I am using the jpedal Viewer inmy code, I embedded the applet code
    in a html file , it is running fine, but when I try to run the same Viewer applet in the Server it is throwing an error
    "java.lang.NoClassDefFoundError: org/jpedal/objects/acroforms/DefaultAcroRenderer
         at org.jpedal.PdfDecoder.startup(Unknown Source)
         at org.jpedal.PdfDecoder.<init>(Unknown Source)
         at pdfViewer.PdfApplet.init(PdfApplet.java:199)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)"
    What is the problem ?
    Please suggest solution for it?
    Its urgent

    I am trying to run the Applet in Tomcat server,
    Could you post the code where you invoke the Applet? It sounds like you're saying you're trying to run the Applet as part of your server-side code. The other interpretation is that you are simply accessing the Applet through the browser that happens to be on the machine being used as the server.
    Like I say, post the code that shows how you're trying to use the Applet "on the server".

  • My itunes stops working when i try to add a music file to the library. how do i fix this?

    when I open iTunes and try to add a music file to my library from my computer, I slecet the song and click open and then it just comes up with the error message saying that iTunes has stopped woking and closes the program... ive tried everything- uninstalling and reinstalling the program and even disabling my antivirus software. I have no other ideas about how to fix this?

    If you are still having this problem, the fix below takes care of it.  It was posted in another conversation by Sony Singh. I did it, rebooted, and all works!!
    Copy QTMovieWin.dll from:  C:\Program Files (x86)\Common Files\Apple\Apple Application Support
    to: C:\Program Files (x86)\iTunes
    Hope this helps or you've already done the fix, especially since you posted in October.

  • How do I add a music file to the playlist I made in iTunes for my iPhone4?

    Apple Tech suggested I make a Playlist for tunes I wanted to play on my iPhone 4, syncing the list to the iPhone 4. But I cannot figure out how to add tunes to this list I made once. I try to drag and drop from my iTunes library, directly on top of this Playlist, but itunes refuses to copy the file to the list. Apple told me not to add music files by manually dropping them on the iPhone4 in iTunes. They specifically said to not do this any longer. So I tried to drop them on the Playlist, but no joy.
    Once I have made a Playlist for the iPhone 4, and synced to the list, how does one ADD any songs to this Playlist?

    Nevermind. In the iTunes Area I can drag and drop tunes onto the iTunes playlist I made, but NO I can't drag and drop to a synced list in the iPhone area of iTunes. Reason is that it only represents the list I sync to in iTunes.
    I did download a Doug Script where I can add files from one play list to another which is neat. Donated some cash for it.

  • How do i Add An Audiobook file to the Audiobook Library Folder????

    I have an audiobook I've downloaded and want to put it in the folder under Library called Audiobooks so they are all together. How do I do this??? The Audiobook is currently in my music folder. Both the audiobooks and music folders are under the Library folder. I can't seem to move this file into the audiobook folder from the music folder. How is this done?????

    You didn't indicate the source of your audiobook, so I'll try to cover both bases.
    First base: If you bought your audiobook from Audible.com and have authorized your computer correctly, the audiobook should go into the built-in Audiobooks folder automagically after you've imported it. This is how I purchase audiobooks – I buy them from Audible, download them directly from Audible's site, then import them into iTunes. Audible spoken word files end with .aa .
    Second base: If you did not get your audiobook from the iTunes Store or Audible, it appears you're out of luck. The Audiobooks folder in the Source Pane is for audiobooks from Audible or the iTunes Store only:
    http://docs.info.apple.com/article.html?artnum=304706
    However, you can make your own smart playlist for your audiobooks. Use 'Get Info' (command-I), choose 'Info', and set the genre of your audiobooks to 'Audiobook' or 'Spoken Word' (or whatever suits you). Then, make a smart playlist to catch them and ignore the default Audiobooks folder from then on.
    When you sync your iPod, that playlist will show up under Music/Playlists, not on the iPod's Main Menu. You can then change the settings on your iPod to not show the prefab Audiobooks folder on the Main Menu.
    It's not an elegant solution, but you'll have all your audiobooks together.
    PowerBook G4 15", 1.67GHz, 100GB HD, 1.5GB DDR SDRAM   Mac OS X (10.4.8)   1st gen iPod 5GB - 3rd gen iPod 40GB - AirPort Extreme network

Maybe you are looking for

  • Windows Explorer Thumbnail View

    Hi guys I am making a photo gallery system software in the main window I want to show images in thumbnail view. however I see people that they use JButton to show each thumbnail I think that's unconventional so I am trying to create something like Wi

  • Openscript / web document

    Hello, please I have a question : web:document what is the web document ? because I understand the web:window which is the browser, td etc. but I dont know to which object it refers to (the document). thank you. Michael

  • 0 stars smart playlist differences

    Hi. I have a smart playlist which reflects all my music files aith 0 star rating. Match - all Rating - is - <no star selected> Media Kind  is - Music Live updating iTunes (Windows 7) shows 59 songs which are not yet rated. However after syncing to my

  • How to set a network as "default"

    I have an Airport Express.. I created my network, but each time I turn on my computer, it chooses someone elses.. Is there some way to set my own network as the "Default" ? Thanks, Awfers

  • Why do we deactivate the extract structure while doing extraction

    Hi experts please let me know why do u deactivate the extract structure while doing extraction