Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Feb 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    using the "paste" (Control+V) function in a batch script to add an image to an email body

    After a long an wandering patchwork of various codes, i reached a point where the last step needed is to activate the "paste function" to put the contents of the clipboard into the body of an email. This is a very simple operation when done by hand as the file to be passed is an image already preloaded into the clipboard. But everything i have tried so far only puts the name of the image (ie: image.png) into the body. If i click the Paste button OR use control+V it puts the actual image in the body but anything i have tried in the batch only puts the image name in text. I can even stop the batch at the final step and press paste and it inserts the image itself. Control+V also uses the image. But any written format inthe script ends up with nothing but the name of the image. Do I ned to reformat the way i am calling for the image to be inserted into the body?


    Any idea as to what I am doing wrong?

  2. #2
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,413
    Thanks
    33
    Thanked 195 Times in 175 Posts
    Quote Originally Posted by questorfla View Post
    Any idea as to what I am doing wrong?
    The only thing I can think of is that you are assuming that BATch files support Paste for images! I have never come this, though I must admit I've never needed to.
    How are you issuing Paste or Ctrl+V within the BATch file, by the way?
    BATcher

    Time prevents everything happening all at once...

  3. #3
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,170
    Thanks
    47
    Thanked 980 Times in 910 Posts
    Even if you could press Ctrl V from within the batch file, how would you guarantee that the email has focus to receive the image?
    I think you should learn to write for AutoIt, that will do all that you want.

    cheers, Paul

  4. #4
    4 Star Lounger
    Join Date
    Jan 2010
    Location
    Fort McMurray, Alberta, Canada
    Posts
    557
    Thanks
    51
    Thanked 68 Times in 66 Posts
    There are a couple of things that spring to mind.

    My first thought was that you had a text format e-mail. These will not accept graphics paste commands no matter what you do. However the fact that you can do this interactively suggests this is not the problem (unless the interactive mode is allowing the e-mail format to change on-the-fly, which isn't unheard of in the e-mail world).

    My next thought was that you are doing this via batch language. Batch is powerfully text oriented and has relatively few tools for dealing with graphics. Just the same, there is a way. Batch language is also a rather powerful file processor, and files can contain anything. Including binary graphics data.

    The concept here is that you convert the clipboard graphics contents to a file, then you append (or attach) the file to the e-mail. The old-school way of doing this is to use Paint. With Windows 7+ you may be able to use the Snipping Tool as well. These are all standard tools in Windows and that makes them suitable for use in batch scripting.

    The problem I've never tackled is, can you interact with these tools via batch language? Usually you need a command line interface with the appropriate switch functionality. I've not done this and a cursory check seems to show the command controls are missing from these tools. However it's a big new world out there. The Open Source world has a lot of tools for situations like this, and many of those tools have been ported to Windows.

    Here's where I start to run out of gas. Handbrake? PixelBender? I know that digital photography has a lot of similar requirements and would be a fertile source of ideas.

  5. #5
    2 Star Lounger
    Join Date
    Dec 2009
    Location
    Surrey, UK
    Posts
    161
    Thanks
    7
    Thanked 39 Times in 35 Posts
    Are you really using a batch file (and not a vba script)? Either way, we need to see the code to be able to help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •