Seminko Posted December 23, 2014 Share Posted December 23, 2014 (edited) Hey fellas, I'm trying to create a tool for one of our teams. When we deliver an order we send the customer an email with a few pieces of data we pull from the order form. So I have this email template with tables. When I copy it and paste it into outlook it pastes the email with all the tables. But the thing is, I need to fill it out first. Is there a way for to set the email for ClipPut so that is retains the table format it is in right now? If so, is there a way for it to be updated and still retain the format? If not, any other suggestion? Do you know a community around VBA that could help me? (obviously this would be much easier via VBA, but unfortunately, I'm a VBA noob) Thanks! PS: Happy holidays Edited December 23, 2014 by Seminko Link to comment Share on other sites More sharing options...
TouchOdeath Posted December 23, 2014 Share Posted December 23, 2014 Is there a way for to set the email for ClipPut so that is retains the table format it is in right now? Clipput and clipget should retain whatever information you pass it. So yes. If so, is there a way for it to be updated and still retain the format? Before you clipput the information into the email, change the variables. It might help to do a search for 'parsing' in the autoit forums. I recommend you take a stab at writing the program yourself and post your code, then we can help you further. Link to comment Share on other sites More sharing options...
Seminko Posted December 23, 2014 Author Share Posted December 23, 2014 Before you clipput the information into the email, change the variables. That's the thing ClipPut resets the format... When I copy the email body, ClipGet, do a StringReplace, ClipPut and then paste it, the table format gets lost. Link to comment Share on other sites More sharing options...
BrewManNH Posted December 24, 2014 Share Posted December 24, 2014 I'm almost certain that ClipPut and ClipGet only work on strings and not anything formatted. You'd need to use the Clipboard UDF to work with anything other than text. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Seminko Posted December 24, 2014 Author Share Posted December 24, 2014 You'd need to use the Clipboard UDF to work with anything other than text. Just googled and found one Clipboard UDF which appears only to be checking if a clipboard was updated or not. Nothing else... Link to comment Share on other sites More sharing options...
Gianni Posted December 24, 2014 Share Posted December 24, 2014 I thinh BrewManNH means the already present Clipboard.au3 in AutoIt. #include <Clipboard.au3> have a look to _ClipBoard_SetDataEx function in help and also to other _ClipBoard* functions Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Seminko Posted December 24, 2014 Author Share Posted December 24, 2014 Ah, thanks. Well the $iFormat doesn't seem to include tables. Link to comment Share on other sites More sharing options...
Jfish Posted December 24, 2014 Share Posted December 24, 2014 When we deliver an order we send the customer an email with a few pieces of data we pull from the order form. Just curious as to what the order form is (i.e. HTML, Word, Excel)? It could make a difference in terms of options to maintain the formatting. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
water Posted December 24, 2014 Share Posted December 24, 2014 Did you have a look at the OutlookEX UDF? It allows to create a new mail based on a template. It should then be easy to change the content of the table. 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...
Seminko Posted December 24, 2014 Author Share Posted December 24, 2014 Did you have a look at the OutlookEX UDF? It allows to create a new mail based on a template. It should then be easy to change the content of the table. Was not sure if it was possible. So I create a template in Outlook and then write a script using OutlookEX to prepopulate certain fields in such template? Link to comment Share on other sites More sharing options...
water Posted December 25, 2014 Share Posted December 25, 2014 Correct. Add placeholders (e.g. %1%, %2% etc.) where you need to insert variable data. Open a new mail item using _OL_ItemCreate and pass the template. Retrieve the property "Body" or "HTMLBody" using _OL_ItemGet, replace the placeholders with your variable data (StringReplace) and set the propery by using _OL_ItemModify again. (I am on vacation right now so the function names might be slightly different). 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...
Seminko Posted December 25, 2014 Author Share Posted December 25, 2014 How do I pass the template though? I though I would create an Outlook template and set some kind of a parameter to _OL_ItemCreate for it to open the template. Link to comment Share on other sites More sharing options...
water Posted December 26, 2014 Share Posted December 26, 2014 IIRC _OL_ItemCreate has a parameter to pass the template name. 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...
water Posted January 3, 2015 Share Posted January 3, 2015 To be precise: It is parameter 4 of function _OL_ItemCreate 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...
Seminko Posted January 3, 2015 Author Share Posted January 3, 2015 (edited) Right, back from holidays. BTW, happy new year everyone. So I chewed throught the template stuff but still can't wrap my head around the placeholders and parameters. I got this: #Include <OutlookEX.au3> #Include <Array.au3> Global $oOL = _OL_Open() Global $oItem = _OL_ItemCreate($oOL, $olMailItem, "", "C:\Users\template.oft") Global $Property = _OL_ItemGet($oOL, $oItem, "", "Body") $PropertyUpd = StringReplace($Property[1][1], "OrderServiceSpeed", "S T U F F") Now I would Item Update but there are those parameters that I don't know how to set up. Edited January 3, 2015 by Seminko Link to comment Share on other sites More sharing options...
water Posted January 3, 2015 Share Posted January 3, 2015 Try: _OL_ItemModify($oOL, $oItem, Default, "Body=" & $PropertyUpd) 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...
Seminko Posted January 3, 2015 Author Share Posted January 3, 2015 Right, that works... but again, it totally messes up the email formatting and pastes everything as text. When you do StringReplace you lose all the formatting. Any idea how to get around that? Link to comment Share on other sites More sharing options...
Solution water Posted January 3, 2015 Solution Share Posted January 3, 2015 Replace the property "Body" with "HTMLBody". "Body" only contains the text part of the body. 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...
Seminko Posted January 3, 2015 Author Share Posted January 3, 2015 SPLENDID!!! Will it work on PCs that do not have admin rights? Read somewhere there might be an issue. Just hope there won't with simple stuff like this. Thanks water! Link to comment Share on other sites More sharing options...
water Posted January 3, 2015 Share Posted January 3, 2015 No admin rights needed up to Outlook 2010. Don't know if Outlook 2013 behaves the same way. 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