water Posted January 28, 2017 Share Posted January 28, 2017 After Ctrl-C the data is on the Clipboard. So use function ClipGet to retrieve this data and then write it to the mail item: $sSubject = ClipGet() _OL_ItemModify($oOL, $oItem, Default, "Subject=" & $sSubject) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mustilem23 Posted January 30, 2017 Author Share Posted January 30, 2017 Dear water , Good Morning, I made your addition, but I get an error like below please help. expandcollapse popup#include <OutlookEX.au3> Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc Opt('TrayIconDebug', 1) Opt("WinTitleMatchMode", 2) _WinWaitActivate("SA Malzemesi Tedarikçisi -","") Local $sText = WinGetTitle("[ACTIVE]") $sText=StringMid($sText,17,9) ;Sorgulama ekranı getiriliyor. sleep(2000) send("{TAB 4}") ;2 veri kopyalanıyor Send("^C") sleep(2000) ;Now please help to copy the data to the email subject section,şimdi email konu kısmına veri kopyalama işlemi için lütfen yardım , $sSubject = ClipGet() _OL_ItemModify($oOL, $oItem, Default, "Subject=" & $sSubject) Global $oOutlook, $oInspector, $oItem ; Open connection to Outlook $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; Access the currently displayed mail item $oInspector = $oOutlook.ActiveInspector If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error accessing ActiveInspector. @error = " & @error & ", @extended = " & @extended) $oItem = $oInspector.CurrentItem If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error accessing current item. @error = " & @error & ", @extended = " & @extended) If $oItem.Class <> $olMail Then Exit MsgBox(16, "OutlookEX UDF", "Current item isn't a mail item. @error = " & @error & ", @extended = " & @extended) ; Add a PDF file $sAttachment ="C:\Users\mdogru\Desktop\Yen\"&"Y20002151.pdf" _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, $sAttachment) ; Change <Test.pdf> to the name of your PDF file - or change the whole path if the fil is stored in a different directory. If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error adding attachment to mail item. @error = " & @error & ", @extended = " & @extended) ; Display item $oItem.Display >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\mdogru\Desktop\evden gelen\OutlookEX 1.2.2.0\_OL_ItemModify.au3" /UserParams +>08:20:14 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0 Keyboard:0000041F OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:041F) +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\mdogru\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\mdogru\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.2) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\mdogru\Desktop\evden gelen\OutlookEX 1.2.2.0\_OL_ItemModify.au3 "C:\Users\mdogru\Desktop\evden gelen\OutlookEX 1.2.2.0\_OL_ItemModify.au3"(29,20) : warning: $oOL: possibly used before declaration. _OL_ItemModify($oOL, ~~~~~~~~~~~~~~~~~~~^ "C:\Users\mdogru\Desktop\evden gelen\OutlookEX 1.2.2.0\_OL_ItemModify.au3"(29,28) : warning: $oItem: possibly used before declaration. _OL_ItemModify($oOL, $oItem, ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\Users\mdogru\Desktop\evden gelen\OutlookEX 1.2.2.0\_OL_ItemModify.au3"(29,20) : error: $oOL: undeclared global variable. _OL_ItemModify($oOL, ~~~~~~~~~~~~~~~~~~~^ C:\Users\mdogru\Desktop\evden gelen\OutlookEX 1.2.2.0\_OL_ItemModify.au3 - 1 error(s), 2 warning(s) !>08:20:14 AU3Check ended. Press F4 to jump to next error.rc:2 +>08:20:14 AutoIt3Wrapper Finished. >Exit code: 2 Time: 1.032 Link to comment Share on other sites More sharing options...
water Posted January 30, 2017 Share Posted January 30, 2017 I think the time has come for you to handle such simple errors yourself. The error is not related to the OutlookEX UDF and the error message clearly describes the problem My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mustilem23 Posted January 30, 2017 Author Share Posted January 30, 2017 Dear Water , I did not really solve it, I did a lot of experimentation please help . I did not really solve it. Link to comment Share on other sites More sharing options...
water Posted January 30, 2017 Share Posted January 30, 2017 But it is so easy. SciTe tells you what is missing. Problem 1: Variable $oOL is unknown. When you have a look in the UDF you will see that the first parameter for _OL_ItemModify is the Outlook object as returned by _OL_Open. But in your script this variable is called $oOutlook. Solution: Change $oOL to $oOutlook Problem 2: Variable $oItem is unknown. $oItem is created with the following statement: $oItem = $oInspector.CurrentItem So you need to move the block with ClipGet() and _OL_ItemModify after this line. Wasn't too hard, was it My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mustilem23 Posted January 30, 2017 Author Share Posted January 30, 2017 Yeah, it was not so hard. I used short and simple autoit There are 2 problems now Subject 2. Data copying Adding emaile by finding the first copied data folder pdf 2nd . I need to use these codes to copy the data $ sSubject = ClipPut () yada help No comments for pdf to be copied, I think the solution is to search the copied folder for the folder and then copy and paste the emaile http://hizliresimyukle.com/image/OwmXj Autoit will first generate a pdf from the IF program, Create a pdf folder to save, Then paste the emaile PDF Then copy it back to the line IFS program and paste it into the subject section of the e-mail. Then copy it again from the line IFS program Copy line 2 and paste it into the e-mail address. And it finished expandcollapse popup#include <OutlookEX.au3> Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc Opt('TrayIconDebug', 1) Opt("WinTitleMatchMode", 2) _WinWaitActivate("Advanced Find and Replace","") Local $sText = WinGetTitle("[ACTIVE]") $sText=StringMid($sText,17,9) ;Sorgulama ekranı getiriliyor. sleep(2000) send("{TAB 4}") ;1 veri kopyalanıyor ,1. copy to the subject okkkkk... Send("^C") sleep(2000) sleep(2000) send("{TAB 4}") ;2 veri kopyalanıyor ,2. copy to the subject Solution required Send("^C") sleep(2000) ;Now please help to copy the data to the email subject section,şimdi email konu kısmına veri kopyalama işlemi için lütfen yardım , Global $oOutlook, $oInspector, $oItem ; Open connection to Outlook $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; Access the currently displayed mail item $oInspector = $oOutlook.ActiveInspector If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error accessing ActiveInspector. @error = " & @error & ", @extended = " & @extended) $oItem = $oInspector.CurrentItem $sSubject = ClipGet() _OL_ItemModify($oOutlook, $oItem, Default, "Subject=" & $sSubject) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error accessing current item. @error = " & @error & ", @extended = " & @extended) If $oItem.Class <> $olMail Then Exit MsgBox(16, "OutlookEX UDF", "Current item isn't a mail item. @error = " & @error & ", @extended = " & @extended) ; Add a PDF file $sAttachment ="C:\Users\mustafa\Desktop\test\"&"Test1.pdf" _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, $sAttachment) ; Change <Test.pdf> to the name of your PDF file - or change the whole path if the fil is stored in a different directory. If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error adding attachment to mail item. @error = " & @error & ", @extended = " & @extended) ; Display item $oItem.Display Please help for the last 2 topics . Link to comment Share on other sites More sharing options...
water Posted January 30, 2017 Share Posted January 30, 2017 expandcollapse popup#include <OutlookEX.au3> Func _WinWaitActivate($title, $text, $timeout=0) WinWait($title, $text, $timeout) If Not WinActive($title, $text) Then WinActivate($title, $text) WinWaitActive($title, $text, $timeout) EndFunc Global $oOutlook, $oInspector, $oItem, $sText, $sSubject, $sRecipient Opt("TrayIconDebug", 1) Opt("WinTitleMatchMode", 2) _WinWaitActivate("Advanced Find and Replace", "") $sText = WinGetTitle("[ACTIVE]") $sText = StringMid($sText,17,9) ; Sorgulama ekranı getiriliyor. ; Copy the subject Send("{TAB 4}") Send("^C") Sleep(2000) $sSubject = ClipGet() ; Copy the email recipient Send("{TAB 4}") Send("^C") Sleep(2000) $sRecipient = ClipGet() ; Open connection to Outlook $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; Access the currently displayed mail item $oInspector = $oOutlook.ActiveInspector If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error accessing ActiveInspector. @error = " & @error & ", @extended = " & @extended) $oItem = $oInspector.CurrentItem If $oItem.Class <> $olMail Then Exit MsgBox(16, "OutlookEX UDF", "Current item isn't a mail item. @error = " & @error & ", @extended = " & @extended) ; Set the subject _OL_ItemModify($oOutlook, $oItem, Default, "Subject=" & $sSubject) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error accessing current item. @error = " & @error & ", @extended = " & @extended) ; Set the recipient _OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $sRecipient) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error setting the recipient. @error = " & @error & ", @extended = " & @extended) ; Add a PDF file $sAttachment ="C:\Users\mustafa\Desktop\test\" & "Test1.pdf" _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, $sAttachment) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error adding attachment to mail item. @error = " & @error & ", @extended = " & @extended) ; Display item $oItem.Display My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mustilem23 Posted January 30, 2017 Author Share Posted January 30, 2017 I want to paste 2 copies on eamil subject but I get 1 copy. I am a seller of goods I think you understand I will bid on the customer and I will write the proposal number and the customer name emaile ; Copy the subject Send("{TAB 4}") Send("^C") Sleep(2000) $sSubject = ClipGet() ; Subject copy 1 ; Copy the email recipient Send("{TAB 4}") Send("^C") Sleep(2000) sSubject = ClipGet() ; Subject copy 2 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