topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 11, 2024, 6:08 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Using a batch file to create a hyperlinked png or jpg image.  (Read 13596 times)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
This may be answered somewhere but everything I have tried fails at the point of use.
I have a batch file that performs various functions and i the final steps creates a link to a page on a website that is output as a text file along with a image file named "invitation.png".
Once completed, I have to open Outlook, start a new email, paste in the 'invitation.png', right click it, choose add hyper-link, then paste in the hyper-link from the text file.
This works perfectly ... but is tedious when done often per day.
 
Being a big fan of automation and having a working batch file that already creates all the necessary parts, I am looking for a way to combine the final "done by hand" part.
But apparently automating the insertion of a hyper-link into an image file which is then sent via an email is beyond anything I can follow. I tried most methods I could come up with but  did not get any that worked.

Given that I have the necessary parts, is there a scripting maneuver to get this hyper-link embedded into the png file and put the whole thing into the body of an email ready to send? 

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,939
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #1 on: April 23, 2015, 11:25 PM »
Too little info to go on, but I'll try anyway.

If Outlook is required, you better use PowerShell, which is more powerful and can access applications & servers installed on your system in ways batch scripts cannot even dream of.
But if that isn't the case, you could use batch script in combination with a command-line mailer (3rd party or what is included with Windows) and push out the messages that way. With batch scripts it is usually best to keep things as simple as possible.

There are even SMTP servers you run from the command line on your computer...but use those at your own peril. You don't want your IP address being blocked by organizations that patrol the internet for spammers.

Maintaining your own mail server is a job not for the faint of heart, because there are so many ways of doing it wrong. Better use the mail services provided by your ISP or mail host.
A command-line mailer can send mail through those services without problems, provided you use ports that aren't blocked. Most ISP's block port 25 by default to prevent unsanctioned SMTP traffic (a.k.a spam).

Find out how Outlook is sending your mail now (SMTP/IMAP/Exchange/whatever) and find a command-line mailer that can do the same. Use the settings from Outlook with the command-line mailer and you should be able to send mail just like Outlook does, only without Outlook. From here it should be relatively easy, as you already have the rest of the "building blocks".

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #2 on: April 23, 2015, 11:55 PM »
I don't have Outlook but I would think it would be easier to put the image on a server then you would only need a line in the message body to call it, (IIRC), eg.
Code: Text [Select]
  1. <a href=URL><IMG=image URL></a>

This could then be used in a command file using the information from here:


https://support.micr....com/en-us/kb/287573

The last section, Single command-line string for a message with subject and body, would create the email so all you'd need to do is hit send.

So goes the theory.

Only problem is if the image change for each email.

See here for attaching from the command line but I've got no idea what HTML/whatever you'd need in the body to create the URL link using an attachment.

http://stackoverflow...ed-from-command-line
« Last Edit: April 24, 2015, 12:07 AM by 4wd »

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #3 on: April 24, 2015, 12:28 AM »
Thanks shade.  Mailto is the function use to get outlook to open a new email.  It works very well.  But getting the image into the opened email is going to be either AHK or ???
I have looked ever where for a command to grab a file and put it in the mail.  It  is SO easy to do  copy and paste or any number of screen capture programs leave exactly what i need onthe windows clipboard where a paste command is all it takes.
This is a straight up Window setup MS Outlook and all.  I know what needs to be done but am short on the "how to do it" department. :(

Once I get the image into the email then i think i am in unknown territory needing to use VBA scripting to manipulate items in an email which will probably kill the whole thing.
Once upon a time, you could simply embed hyper-links in images anyway but the only ones that can do that now (as fas as  know) are "favicon.ico" files
Maybe there is a way I can copy the favico.ico file into the email but not sure it would even function as a web-link if done that way?  Never tried that.

This is one of those exercises in effort that probably are not worth anything other than to find out if it can be done?

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #4 on: April 24, 2015, 01:26 AM »
Thanks 4wd!  You ALMOST got me there.  That link has a lot of the arcane wigged out architecture for it.
It is working now ALMOST.
the strctest sense of ot is this structure:

"C:\Program Files\Microsoft Office 15\root\office15\OUTLOOK.EXE"/c ipm.note /m "[email protected]&subject=test%20subject&body=test%20body" /a c:\wusa.txt

A few canges to some places got me very close this actuallty does work believe it or not.  the strikeout needs t be chaged out course
the subject etc easy to see how to edit
the body is the final hurdle as i want to put there the contents of the clipboard.  Atthe time this is run, the image is alrady held inthe clipboard and i normally chose paste to add it
so the final part "body=?" to copy contents of clipboard to body.  Then the coup de gras would the addition of the hyper-link.  If this works I think it would be a recipe for scriptng never before used for anything

I am barely runnig on just the memory of coffee from hours ago. so this may have to sleep for the night

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #5 on: April 24, 2015, 01:47 AM »
Down to last step if i can make it.
Need to activate "control+V" or "paste command" from within the batch file.
the deafult paste from location is the clipboard which would have the file needed so if i can run it, the file would insert(ie: paste) right where i want it in the body
I can get all the way to the body of he email, everything is done, it is addresses, notations made, subject written as needed, I guess COULD do it as an attachment but that would be be as impressive :)

I just want t be stubborn about it  :)
Thanks for the help getting to here.  The setup looks impossibly complex and i never thought it would get this close.

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #6 on: April 24, 2015, 03:12 AM »
My WinSendKeys (DC Thread) can apply 'Paste from ClipBoard' (Ctrl-V) from the command-line, to a specific open Window(title)...

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #7 on: April 24, 2015, 11:30 AM »
Thanks ATH.  I will try this today and let you know but it should work.  I searched all over for the windows native function to apply ctrl+v and found nothing.  Nor anything to activate Paste from within an email (other than writing a custom Outlook script which i had no idea how to do)

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #8 on: April 24, 2015, 10:26 PM »
OK, two questions:
1) Is the HTML you are sending to these recipients static, (ie. apart from the recipient email address everything is the same - although that's not really a requirement, it could be built on the fly) ?

2) Does it have to go through Outlook, (I mean, do you REALLY have to use Outlook to send it) ?

If the first answer is Yes and the second No then there is a very simple way to achieve what you want using a simple command line program.

SendEmail

Create your HTML message as a file embedding the graphics as Base64 encoded text and use it as an input to the program:

eg.
Code: Text [Select]
  1. <html>
  2. <body>
  3. This is your basic test email with embedded clickable image.<br>
  4. &nbsp;<br>
  5.  
  6. <a href=https://www.donationcoder.com/forum><img src="data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAABGdBTUEAAK/INwWK6QAAAwBQTFRF
  7. 8axU+euzyfH/Z46308as9syVGG3OmNj77sYv5OfsbLPxNb3+xrOM9Lx0wu7/9+OWWsv/tZE1u+z/
  8. xHYSOZHbYsv/76A9tOr/6+bb6IoU8fP1+dq08rJiwq93wYctSsT/8MtEucTRqeb/0/b+yJVSc5jM
  9. U8r/RML/89RkLpTiouT/4tvK3OHnrLnLkqnI+OakxqgvQLnza9L/8KNCpN78m+L/ctP/dsz8hNr/
  10. 1tzj+uHC+Pn68tJZsK2Hi93/y9PbVMb/6shL7p448rBc+Nar9PHr9Nl05sZWpbG2VpHMvKV7ruj/
  11. 9cKCfdn/0MKKkqy0sZFTLLn6+d25Y9H/8ezjk9//etX/6e3wNqTm+NKk75cqVbr1hMr0rZlk8alO
  12. iOT+9sWIW8L+++XJzqcZ/f3875MgPb//2LZH39XERpni9b989t6HSrHvRajlWbTsz+rq2H8Qg5my
  13. +u2/ac7/uvH+IJPixM3X87VoW6jrZaW5jot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7IzKyaxCTyOamajYAHDILXb41dEVgHMAmdJo35e+8Z4/jVLX0HKEQHSP/DDEADfsRerA54CQsB
  95. EVadO1USPOJlphc0NUgmR+jG2hROrLmkawMYdJZM2Wy8qXLLJNfVrtNWT9PGauS4cePGSyyC471V
  96. v52q7ex4+JBuDpE5oIQ8o3bE5JYkZF+416z4AwBtCl5TWeXISSi6lMQQuDDwN8iw86UNGz6ARADD
  97. o3urgq5dO4WRcu23IM6JEyeunaqFJ0SoghROorkSNsr6fJxPFe5e6GE2CdSHQPyZDfiZQqxeDQgP
  98. Niz+gPhgPadiDBsVFTNmzBiz6tw18mgSZn/hkbFC0esWTbfRDjkoq9wybSlVf4ENFgIZEOHB4sUe
  99. ixa9Yl5oXEjCGKOw0LxizLC7sH1qYWHvhYsxsuroE4BaARYcNHNdOgTV//LCX2jATwwEMiBCwJnK
  100. RVaFTUs04d7svqTJGBHu3btw9+4lWA1aVywJV/QRoEWq5C0x99gybQjqY3xHAiEoAhJAMVSbVW4y
  101. 5vF44fTCkPF47ksAYQbk5dGjR+nW1taO5ry+HulUqyTNTUBwmgCg9lv0k0UAE4CgemSlB3S6UiFX
  102. QsiVCnGDWKGQhPOawQaEgDAvLGxyl/TVgZZ2hcSdIUCAt2igCd9RBPTgxhYzD2Nc62gDNn/V+4uU
  103. Ei7Y0ISxBKdi9f79fT5VK1WENzcVlp1xHfKCFoAwEBMwC9NczY7B+BVP0qsUSkl4OI/X3Oze3MwL
  104. lyj3t/f9WC94AAQOi6vRhO/e0vGAFCMSuJ4B/e7mmZb2/fshLTKJJFwigQyppOq+AyABz924sIwi
  105. UBs0hYhJGOJqNkupaO/xeOh+lUqhUigaGp7crjbsYHO7VClphoJ2+OqB62nshxfYAmTmpaVbNkh6
  106. O60CJUHqQt3Xu6GOCcpwLGhzh7JjD3buXI1R/dLnxz53PU0AwIIW9X/+XLGeCYDAa3ZvwsnF3AHD
  107. HPrKvOzMpNOnoQ+2VBo/69P17VIVNHY41DPEEvxC5jrzssVntkzasqVykYO7sv1ZH+/HtsK+IgFl
  108. LSFznUPZV4s9PDw2lblLn8c/cGiTwusfLGvpfvSEScssY2P3ZqXquf8LC1IakBaIcFjySZ87AM6U
  109. JC1kmpG2/zcAsM3bpRDt7c+2C55N9AP8H/b+uGdasqyCAAAAAElFTkSuQmCC"></a>
  110. </body>
  111. </html>

Then in your command file you just need the line:

Code: Text [Select]
  1. sendEmail -f [email protected] -t [email protected] -s smtp.fromserver.com -u "Invitation" -o message-file=Invitation.html -o message-content-type=html

I've skipped the options for TLS, user, password, etc but they can be added if your mail server requires them.

I've tested this through Google' email system and it works fine.

The requirement to use Outlook shouldn't really be necessary as there will be a record of the sent email on the server that can always be accessed via IMAP/etc.

I sent you a test email to show you what you'll get ;)

Here's an online Base64 encoder for converting the images.
« Last Edit: April 24, 2015, 10:32 PM by 4wd »

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #9 on: April 25, 2015, 12:06 PM »
Hmm.   :-\
OK  I'm game.  If this works I promise I will never doubt your prowess.
 :D

Replies to questions:
No it  does not have to go through Outlook i just need to get it to them via email
However, i am afraid there may be a slight issue in that it isn't html,  it is an email like i sent you.
the png image is in the body of the email  I will look for your reply have not looked at email this am yet

The output of the batch is a PNG image.  Or could be a jpg i guess but i have not tried embedding hyper-link in jpg )
The Manual part is copying the png into an open email and anchoring the hyper-link into it
« Last Edit: April 25, 2015, 12:11 PM by questorfla, Reason: added info »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #10 on: April 25, 2015, 07:19 PM »
If it includes a hyperlinked image like the email you sent me, then it's HTML body in it, and the test email I sent you is using a encoded PNG image, (even though I forgot to change the jpg to PNG in the code above, Thunderbird handled it OK - it knew what I meant :D ).

So to get this straight: the command file generates a PNG image that it inserted into an otherwise static content email?

Any chance you can send me a complete finished email and tell me which image changes?
« Last Edit: April 25, 2015, 07:29 PM by 4wd »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #11 on: April 26, 2015, 05:03 AM »
For converting an image to base64 I used this freeware multi-platform off-line/command-line Base64 De-/Encoder (no connections, just a happy user). It supports output to stdout so redirecting output directly into the message from a batch-file is easy-peasy :up:
« Last Edit: April 26, 2015, 05:10 AM by Ath, Reason: Replaced url from cnet to source »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #12 on: April 26, 2015, 08:05 AM »
Yeah, found that one and was going to use it, (my mistake I was going to use this one) ... however, unfortunately Outlook is incredibly anal when it comes to displaying the resulting email sent via the above method.

Whereas, Thunderbird is a bit more flexible and has no problem displaying it inline and hyper-linked, Outlook requires that the image be attached and that you use Content-Dispositionw structure to display it inline correctly ... it can't handle the inline encoded image data.

I really, really hate HTML emails.

But we have to cater for the LCD.

However, I think I've found a Powershell script that can send an email using XSL templates, so it should just be a matter of creating an HTML template, addressing, and specifying image attachments ... hopefully.

BTW, for Base64 encoding you can also use the Windows command certutil, (unfortunately it sticks a header and footer on the output).
« Last Edit: April 26, 2015, 08:12 AM by 4wd »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #13 on: April 27, 2015, 08:13 PM »
FWIW, the command line utility Blat is able to create and send HTML emails with embedded images.

Just create your HTML email source using <img src="cid:image-name"> tags and then use -embed to attach the images.

eg.
Code: Text [Select]
  1. blat.exe -to [email protected] -subject "Embedded images" -bodyF "test_email.html" -html -embed "Top.jpg","Middle.png","Footer.png"

SMTP server info, (missing in above), can be specified in command line or saved to registry so it need not be entered every time.

Only downside is Blat can't handle secure server connection but you could get around that by the extra step of using stunnel.

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #14 on: April 28, 2015, 08:42 PM »
Thanks 4WD.  PROBLEM  OFFICIALLY SOLVED!  Coming from someone who doesn't even use Outlook :) I would say you did one heck of a job! :Thmbsup:

I had gathered a bunch of various utilities but had not figured out how to run them  Thanks Very much for the info!  I got your email and it worked!  :)

PS:  I thought Blat was a Beer Brand?  Doesn't Homer Simpson drink it?

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #15 on: April 29, 2015, 04:36 AM »
PS:  I thought Blat was a Beer Brand?  Doesn't Homer Simpson drink it?
he used drink Duff


Dunno if Blat based on the Russian word:
Blat (term), a form of corruption in Russia and the Soviet Union
According to Max Vasmer, the origin of the word blat is the Yiddish blatt, meaning a "blank note" or a "list".[5] However, according to both Vasmer and N. M. Shansky, blat may also have entered into Russian as the Polish loanword blat, a noun signifying "someone who provides an umbrella" or a "cover".[5] The word became part of Imperial Russian criminal slang in the early 20th century, where it signified relatively minor criminal activity such as petty theft.[5]
-https://en.wikipedia.org/wiki/Blat_%28term%29#Origin

[look who's procrastinating ;-)]
Tom

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Re: Using a batch file to create a hyperlinked png or jpg image.
« Reply #16 on: April 29, 2015, 09:54 PM »
More likely the dictionary meaning:

1
  • :  to cry like a calf or sheep :  bleat
2
  • a :  to make a raucous noise
  • b :  blab
transitive verb
  • :  to utter loudly or foolishly :  blurt
  • — blat noun
Examples of BLAT

    <blatted an obscene expletive before biting the dust>

Origin of BLAT
perhaps alteration of bleat
First Known Use: 1846
Related to BLAT

Synonyms
    exclaim, blurt (out), bolt, cry (out), ejaculate

Or I guess I could go look at the history  :-\

History of Blat

Who wrote Blat?

    Pedro Mendes & Mark Neal until October 1998
    Tim Charron & Gilles Vollant after October 1998

Where did the name Blat come from??

``NO real reason for calling it blat... actually I wanted to call it Blat mainly because Pedro thought it was a ridiculous name. And then because we could say things like 'I'm just going to blat off a quick email to ...' etc...''

--Mark Neal