Need Help Passing Variable Format to Outlook

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Rishu0182
Posts: 33
Joined: 02 Feb 2017, 11:49

Need Help Passing Variable Format to Outlook

16 Aug 2018, 12:21

So basically in the code below, vTest loses its format when it passes into Outlook. It looks correct in the edit field, it comes out correctly in the sendinput as seen in the F2, but when it appear in the email in outlook it just comes out all on one line. I am trying to find a way to make sure that it keeps its formatting when it enter the table in Outlook. Any advice is greatly appreciated

Code: Select all

#Persistent
ESC::Reload

F1::
Gui, Destroy
Gui, Add, Edit,w800 r20 vTest, 
gui, add, button, gOk, OK
Gui, Show
return

F2::
SendInput %Test%
return

Ok:
Gui, Submit, NoHide
email := ComObjCreate("Outlook.Application").CreateItem(0)
tabledata := [[ "",""],[ (Test), ""]] 
email.HTMLbody .= AddTable(tabledata)
email.Display
return

AddTable( tdata = "", w = 200, h = 0, p = 0)
{
    if !IsObject( tdata )
        tdata := [["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""],["",""]]

    style =
    (
    <style> .tbl { border:10px; border-collapse:collapse;}
.tbl th { border:0px;} .tbl td { border:0px;}
.tbl td { width: %w%px; height: %h%px; padding: %p%px; }</style>
    )
    table_html = <table class="tbl"><thead></thead><tbody>
    for each, row in tdata
    {
    for i in ( row, tables .= "</tr><tr>" )
        tables .=  "<td>" (( r:=row[ i ] ) = "" ? "&nbsp;" : r ) "</td>"
    }
    return style . table_html . SubStr(tables,6) "</tr></tbody></table>"
}
Rishu0182
Posts: 33
Joined: 02 Feb 2017, 11:49

Re: Need Help Passing Variable Format to Outlook

16 Aug 2018, 13:34

If anyone is curious, I figured it out. Needed

Code: Select all

StringReplace, Test, Test, `n,<br />,All

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, RandomBoy and 414 guests