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

    Home » Forums » AskWoody support » Productivity software by function » Productivity software by function – other » using the “paste” (Control+V) function in a batch script to add an image to an email body

    • This topic has 4 replies, 5 voices, and was last updated 10 years ago.
    Author
    Topic
    #499645

    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?

    Viewing 3 reply threads
    Author
    Replies
    • #1501507

      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

      Plethora means a lot to me.

    • #1501538

      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

    • #1502078

      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.

    • #1502575

      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.

    Viewing 3 reply threads
    Reply To: using the “paste” (Control+V) function in a batch script to add an image to an email body

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: