Jewtus Posted November 3, 2014 Share Posted November 3, 2014 This is the code that I'm executing. $HTMLsource=FileRead('C:\Users\n811761\Desktop\Test.htm') $emailAddress = 'Test@Fake.com' $olApp = ObjCreate("Outlook.Application") $olMailItem = 0 $objMail = $olApp.CreateItem($olMailItem) $objMail.Save With $objMail .To =($emailAddress) .Subject = ("Thank You for Contacting!") .HTMLBody = ($HTMLsource) .Display EndWith $oOApp = 0 The problem I'm having is that the HTML file has references to image files. I was looking at GDIPlus, and it seems like I should be able to convert the image files into a string that I can save so the HTML becomes self contained, but I'm not sure exactly how. I've attached a copy of the HTML and its resource files. If someone could steer me in the right direction, that would be great. test.zip Link to comment Share on other sites More sharing options...
Solution MikahS Posted November 3, 2014 Solution Share Posted November 3, 2014 (edited) something like this? #Include <GDIPlus.au3> _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@SystemDir & "\DirectX\Dinput\act_rs.png") $sCLSID = _GDIPlus_EncodersGetCLSID("BMP") _GDIPlus_ImageSaveToFileEx($hImage, @ScriptDir & "\act_rs.bmp", $sCLSID) _GDIPlus_ShutDown() taken from: >link Edited November 3, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Jewtus Posted November 3, 2014 Author Share Posted November 3, 2014 That's what I needed... I was trying to find that exactly! Much appreciated! Link to comment Share on other sites More sharing options...
MikahS Posted November 3, 2014 Share Posted November 3, 2014 My pleasure! Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
water Posted November 3, 2014 Share Posted November 3, 2014 Or you could use my OutllokEX UDF, attach the image and reference using CID as described in the _OL_ItemCreate example. MikahS 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Jewtus Posted November 4, 2014 Author Share Posted November 4, 2014 I was trying to leverage your script water, but I just needed a simple send email function so I didn't want to add a whole UDF. I ended up finding this command: $objMail=$olApp.CreateItemFromTemplate and .HTMLBody = StringReplace($objMail.HTMLBody, "%25Hyperlink%25", $strHyperlink) and I was able to specify the template file which contained the images so I didn't need to transform the images. It also made string replacement much easier with the template file. Link to comment Share on other sites More sharing options...
water Posted November 4, 2014 Share Posted November 4, 2014 The big advantage of running obfuscator when compiling a script is that you can strip off any uunused functions. So the overhead of using a UDF is reduced. But you are right: Anything that can be done using an UDF can be done directly in the script My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Developers Jos Posted November 4, 2014 Developers Share Posted November 4, 2014 The big advantage of running obfuscator when compiling a script is that you can strip off any uunused functions. So the overhead of using a UDF is reduced. But you are right: Anything that can be done using an UDF can be done directly in the script Obfuscator? guess you are a couple of releases behind. Use AU3Stripper for that. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
water Posted November 4, 2014 Share Posted November 4, 2014 Seems my computer is up to date but not my brain My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now