sumandevadiga Posted March 6, 2017 Share Posted March 6, 2017 Hello Water, I have tried signature and send command, but still this not working or activated, can you advise what is not correct? #include <OutlookEX.au3> Global $sReference = "Reference-Value" Global $sVessel = "Vessel-Value" Global $sHAWB = "HAWB-Value" Global $ssubject1 = "Carting Order" Global $subject = $Eihb & " " &$ssubject1 ; Create table Global $sStyle = "<style>table, td { border: 1px solid black; border-collapse: collapse}</style>" Global $sBody = $sStyle & "<Table> <TR><TD>" & $sReference & "<TD>" & $EiRef & "</TD>" &"</TD></TR>" & "<TR><TD>" & $sVessel & "<TD>" & $vsl & "</TD>" & "</TR></TD>" & "<TR><TD>" & $sHAWB & "<TD>" & $Eihb & "</TD>" & "</TD></TR></TABLE>" ; Create the item Global $oOutlook = _OL_Open() Global $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*", "", "BodyFormat=" & $olFormatHTML) If @error <> 0 Then Exit MsgBox(16, "Outlook", "Error creating the mail item. @error = " & @error & ", @extended = " & @extended) WinWait("[CLASS:rctrl_renwnd32]") $oItem.GetInspector $sSignature = $oItem.HTMLBody $oItem.HTMLBody = $sBody & $sSignature $oItem.Display ControlSetText("[CLASS:rctrl_renwnd32]", "", "RichEdit20WPT1",$sCellValue) ControlSetText("[CLASS:rctrl_renwnd32]", "", "RichEdit20WPT4",$subject) _OL_ItemSend Link to comment Share on other sites More sharing options...
water Posted March 6, 2017 Share Posted March 6, 2017 This works for me: #include <OutlookEX.au3> Global $sReference = "Reference-Value" Global $sVessel = "Vessel-Value" Global $sHAWB = "HAWB-Value" Global $ssubject1 = "Carting Order" Global $Eihb = "Eihb", $EiRef = "EiRef", $vsl = "vsl" Global $subject = $Eihb & " " & $ssubject1 ; Create table Global $sStyle = "<style>table, td { border: 1px solid black; border-collapse: collapse}</style>" Global $sBody = $sStyle & "<Table> <TR><TD>" & $sReference & "<TD>" & $EiRef & "</TD>" & "</TD></TR>" & "<TR><TD>" & $sVessel & "<TD>" & $vsl & "</TD>" & "</TR></TD>" & "<TR><TD>" & $sHAWB & "<TD>" & $Eihb & "</TD>" & "</TD></TR></TABLE>" ; Create the item Global $oOutlook = _OL_Open() Global $oItem = _OL_ItemCreate($oOutlook, $olMailItem) If @error <> 0 Then Exit MsgBox(16, "Outlook", "Error creating the mail item. @error = " & @error & ", @extended = " & @extended) ; Set mail format to HTML _OL_ItemModify($oOutlook, $oitem, Default, "BodyFormat=" & $olFormatHTML) ; Retrieve signature $oItem.GetInspector $sSignature = $oItem.HTMLBody ; Set Body to text plus signature $oItem.HTMLBody = $sBody & $sSignature $oItem.Display ; _OL_ItemSend 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...
sumandevadiga Posted March 6, 2017 Share Posted March 6, 2017 Hello Water, yes, i can see signature got added successfully but email not send. #include <OutlookEX.au3> Global $sReference = "Reference-Value" Global $sVessel = "Vessel-Value" Global $sHAWB = "HAWB-Value" Global $ssubject1 = "Carting Order" Global $subject = $Eihb & " " &$ssubject1 ; Create table Global $sStyle = "<style>table, td { border: 1px solid black; border-collapse: collapse}</style>" Global $sBody = $sStyle & "<Table> <TR><TD>" & $sReference & "<TD>" & $EiRef & "</TD>" &"</TD></TR>" & "<TR><TD>" & $sVessel & "<TD>" & $vsl & "</TD>" & "</TR></TD>" & "<TR><TD>" & $sHAWB & "<TD>" & $Eihb & "</TD>" & "</TD></TR></TABLE>" ; Create the item Global $oOutlook = _OL_Open() Global $oItem = _OL_ItemCreate($oOutlook, $olMailItem) If @error <> 0 Then Exit MsgBox(16, "Outlook", "Error creating the mail item. @error = " & @error & ", @extended = " & @extended) ; Set mail format to HTML _OL_ItemModify($oOutlook, $oitem, Default, "BodyFormat=" & $olFormatHTML) ; Retrieve signature $oItem.GetInspector $sSignature = $oItem.HTMLBody ; Set Body to text plus signature $oItem.HTMLBody = $sBody & $sSignature $oItem.Display WinWait("[CLASS:rctrl_renwnd32]") ControlSetText("[CLASS:rctrl_renwnd32]", "", "RichEdit20WPT1",$sCellValue) ControlSetText("[CLASS:rctrl_renwnd32]", "", "RichEdit20WPT4",$subject) ; _OL_ItemSend Link to comment Share on other sites More sharing options...
water Posted March 6, 2017 Share Posted March 6, 2017 Could you please add code tags when posting code - makes it easier to read. Use the "<>" button in the editor. 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 March 6, 2017 Share Posted March 6, 2017 Please drop the following lines: WinWait("[CLASS:rctrl_renwnd32]") ControlSetText("[CLASS:rctrl_renwnd32]", "", "RichEdit20WPT1",$sCellValue) ControlSetText("[CLASS:rctrl_renwnd32]", "", "RichEdit20WPT4",$subject) It does not make sense to use COM and then automate the GUI. Remove the semicolon from line ; _OL_ItemSend This makes it a comment and hence it does not get executed 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...
sumandevadiga Posted March 6, 2017 Share Posted March 6, 2017 Hello Water, I have used ControlsetText to update subject and recipient, i have removed semicolon from line, am getting attached error. Link to comment Share on other sites More sharing options...
water Posted March 6, 2017 Share Posted March 6, 2017 To add the subject modify the following line: _OL_ItemModify($oOutlook, $oitem, Default, "BodyFormat=" & $olFormatHTML, "Subject=" & $sSubject) To add recipients use function _OL_ItemRecipientAdd. 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...
sumandevadiga Posted March 6, 2017 Share Posted March 6, 2017 Hello Water, Super!, you are un believable Link to comment Share on other sites More sharing options...
water Posted March 6, 2017 Share Posted March 6, 2017 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...
sumandevadiga Posted March 7, 2017 Share Posted March 7, 2017 Hello Water, I was looking to pull Invoice Number from our internal system, however issue is that, data is not constant in our system to one place and there will be multiple invoice number for single file, for eg: if "Invoice header" is in Class TEIEdit14 then data will be in invoice number " TEIEdit12" like wise TEIEdit18 and TEIEdit16 All invoice number need to add and club under one variable and send to excel under one cell. What is best loop for such script? Link to comment Share on other sites More sharing options...
water Posted March 7, 2017 Share Posted March 7, 2017 So text "Invoice header" is in Class TeIEdit(n) whereas the invoice number is in Class TelEdit(n-2)? The next pair of Edits would then be TelEdit(n+4)? What is the lowest and highest value for n we need to process? Would n have a leading 0 if < 10? Means: Should we process TeIEdit2 or TelEdit02? 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...
sumandevadiga Posted March 7, 2017 Share Posted March 7, 2017 Dear Water, See my comments So text "Invoice header" is in Class TeIEdit(n) whereas the invoice number is in Class TelEdit(n-2)? Yes, less 2 count The next pair of Edits would then be TelEdit(n+4)?,yes, next section is addition of count 4 What is the lowest and highest value for n we need to process? Lowest TeIEdit12 and hieghest 60 Would n haver a leading 0 if < 10? Means: Should we process TeIEdit2 or TelEdit02- i dont think this applicable because lowest is TeIEdit12 Link to comment Share on other sites More sharing options...
water Posted March 7, 2017 Share Posted March 7, 2017 Have you already tried to retrieve the value of a single control? Just to know that AutoIt is able to access this controls? 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...
sumandevadiga Posted March 7, 2017 Share Posted March 7, 2017 Dear Water, No i have not tried, am looking for your help, if i use below loop or something like that,will this work? For $n = 60 To 12 Local $sText = ControlGetText($hWnd, "", "TeIEdit($n) ") Next Link to comment Share on other sites More sharing options...
water Posted March 7, 2017 Share Posted March 7, 2017 Let's start with a single control: Local $sText = ControlGetText($hWnd, "", "TeIEdit12") MsgBox(0, "Result", @error & " - " & $sText) 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...
sumandevadiga Posted March 8, 2017 Share Posted March 8, 2017 Hello Water, I mean I have used single control but never tried inside loop. Local $hWnd = WinGetHandle($TiTle, '') Local $EiRef = StringStripWS(ControlGetText($hWnd, '', 'TEIEdit106'),8) ;getting the file number Local $vsl = StringStripWS(ControlGetText($hWnd, '', 'TEIEdit85'),8) ;getting the vessel details Local $Eihb = StringStripWS(ControlGetText($hWnd, '', 'TEIEdit54'),8) ;getting the vessel details Local $clientno = StringStripWS(ControlGetText($hWnd, '', 'TEIEdit103'),8) ;getting the vessel details Link to comment Share on other sites More sharing options...
sumandevadiga Posted March 8, 2017 Share Posted March 8, 2017 Hello Water, I want to club all POs under one variable inside this loop, can you please help If WinExists('EXPORT') = True Then WinActivate('EXPORT') $TiTle = WinGetTitle('EXPORT') EndIf ;******************************************************************************************************************************************************************************** Local $hWnd = WinGetHandle($TiTle, '') For $i = 1 to 97 Local $po1 = StringStripWS(ControlGetText($hWnd, '', "TEIEdit" & $i),8) ;getting the file number If $po1 = "P/O" Then Local $ponum = StringStripWS(ControlGetText($hWnd, '', "TEIEdit" & $i+1),8) ;getting the file number Local $ponum1 = $ponum & " " &$ponum1 MsgBox(0, "Result", @error & " - " & $ponum1) EndIf Next ;******************************************************************************************************************************************************************************** Link to comment Share on other sites More sharing options...
water Posted March 8, 2017 Share Posted March 8, 2017 2 hours ago, sumandevadiga said: I mean I have used single control but never tried inside loop. For $i = 12 To 60 Step 4 $sHeader = ControlGetText($hWnd, '', "TEIEdit" & $i) $sInvoice = ControlGetText($hWnd, '', "TEIEdit" & $i-2) ; Process the values to your liking Next 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...
sumandevadiga Posted March 8, 2017 Share Posted March 8, 2017 Hello Water, Can you help me to club 2 variable inside loop, which i have shown in my earlier message Link to comment Share on other sites More sharing options...
water Posted March 8, 2017 Share Posted March 8, 2017 Do not define variables inside a loop: If WinExists('EXPORT') = True Then WinActivate('EXPORT') $TiTle = WinGetTitle('EXPORT') EndIf Local $ponum, $ponum1 Local $hWnd = WinGetHandle($TiTle, '') For $i = 1 to 97 Local $po1 = StringStripWS(ControlGetText($hWnd, '', "TEIEdit" & $i),8) ;getting the file number If $po1 = "P/O" Then $ponum = StringStripWS(ControlGetText($hWnd, '', "TEIEdit" & $i+1),8) ;getting the file number $ponum1 = $ponum & " " &$ponum1 MsgBox(0, "Result", @error & " - " & $ponum1) EndIf Next 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