
cheesestain
Active Members-
Posts
37 -
Joined
-
Last visited
cheesestain's Achievements

Seeker (1/7)
0
Reputation
-
OutlookEX UDF & _OL_ItemFind
cheesestain replied to cheesestain's topic in AutoIt General Help and Support
I'd have to double check, but at a glance it does appear that we both have Windows 7 with Outlook 2013. -
OutlookEX UDF & _OL_ItemFind
cheesestain replied to cheesestain's topic in AutoIt General Help and Support
I checked on both my computer and my coworkers. When the email is opened in outlook the title of the window has (HTML). Also the URL in the body has a clickable hyperlink. -
I'm having a problem with the way _OL_ItemFind is storing the body of an email in the array. When I view the part of the array that contains the body of the email on my computer it shows URL's as <http://url>. However, when my coworker is using the same script the array displays the same email with URL as: HYPERLINK "http://url" This is how i'm using _OL_ItemFind Global $dItems = _OL_ItemFind($oOutlook, $Mailbox, $olMail, "", "Subject", "NonEMM", "Subject,Body,EntryID,ReceivedTime", "[ReceivedTime]") Global $dlink = _StringBetween($dItems[1][1], ".txt <", ">")
-
Trying to write to array
cheesestain replied to cheesestain's topic in AutoIt General Help and Support
I figured it out. I guess what I want to know now is what's the fastest way to write ~20K lines to excel? Writing each line inside the for loop or from the array? -
I'm trying to read a file to an array, strip some data and then write it back to an array so I can put it into an excel file. I'll be writing up to 20K lines to excel so i'm not sure if this is the most efficient way but I'm running into a problem and it looks like no data is written to the array. #include <FileConstants.au3> #include <File.au3> Local $VendorFile = "C:\test.txt" Local $OpenVendorFile = FileOpen($VendorFile, $FO_READ) Local $Header = FileReadLine($OpenVendorFile, 1) Local $PO = StringLeft($Header, 10) Local $VendorID = StringStripWS(StringMid($Header, 53, 10), 8) Local $Records = StringMid($Header, 31, 6) Local $ActualRecords = _FileCountLines($VendorFile) - 1 Local $Detail = FileReadLine($OpenVendorFile, 2) Local $MPC = StringStripWS(StringMid($Detail, 31, 20), 8) Local $SAPSKU = "SKUTEST" Local $Description = "MATERIAL DESCRIPTION" FileClose($OpenVendorFile) Local $aVendorFile _FileReadToArray($VendorFile,$aVendorFile) ;_ArrayDisplay($aVendorFile) Local $aExcelArray[$ActualRecords][6] For $k = 2 To UBound($aVendorFile[0]) - 1 $PalletID = StringStripWS(StringMid($aVendorFile[$k],351,30),8) $SerialNumber = StringStripWS(StringMid($aVendorFile[$k],81,20),8) $MasterCarton = StringStripWS(StringMid($aVendorFile[$k],181,20),8) $aExcelArray[$k][0] = $PO $aExcelArray[$k][1] = $SAPSKU $aExcelArray[$k][2] = $Description $aExcelArray[$k][3] = $SerialNumber $aExcelArray[$k][4] = $PalletID $aExcelArray[$k][5] = $MasterCarton Next ;_ArrayDisplay($aExcelArray)
-
_Excel_Close and don't save
cheesestain replied to cheesestain's topic in AutoIt General Help and Support
The macro logs into SAP, exports data to .xls, copy data from .xls to the .xlsm. The AutoIt script stores some data to an array. At this point I have what I need and don't need the .xlsm saved to that's why I want to close without saving. -
_Excel_Close and don't save
cheesestain replied to cheesestain's topic in AutoIt General Help and Support
Still having trouble. it looks like this line is the culprit. $oExcel.Run("MB51_Extract") If i comment it out _Excel_Close works as expected and doesn't save. Any ideas why running the macro will show the save yes/no/cancel prompt. -
_Excel_Close and don't save
cheesestain replied to cheesestain's topic in AutoIt General Help and Support
LOL oops. I set it to true to test. Changed it back to false. _Excel_Close($oExcel,False,True) -
_Excel_Close is set to False for save changes but it doesn't seem to be working. Excel is stuck at the save yes/no/cancel prompt. Local $oExcel = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpen Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; Open an existing workbook and return its object identifier. Local $sWorkbook = @ScriptDir & "\Validation.xlsm" Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpen Example 1", "Error opening '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpen Example 1", "Workbook '" & $sWorkbook & "' has been opened successfully." & @CRLF & @CRLF & "Creation Date: " & $oWorkbook.BuiltinDocumentProperties("Creation Date").Value) _Excel_RangeWrite($oWorkbook, "Validation", $PO, "A2") _Excel_RangeWrite($oWorkbook, "Validation", $VendorID, "D2") _Excel_RangeWrite($oWorkbook, "Validation", $MPC, "C2") $oExcel.Run("MB51_Extract") ; if your macro name is default_macro you do not need to include the sheet name, also you need to run the macro on the application not the workbook $aUniqueID = _Excel_RangeRead($oWorkbook, "Validation", "E2:E11", 1) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 2", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel,True,True) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel", @error)
-
I have a script that uses IE.au3 to navigate a web site and upload a file. I need to create a condition to handle the IE open/save notification bar that pops up. After the upload I'm using _StringBetween to determine if _IEBodyReadText($oIE) contains certain text. If it does then success, if not it should handle the IE open/save notification bar and cancel report failure. To get around the IE open/save notification bar I used IUIAutomation to cancel. #include <Constants.au3> #include <IE.au3> #include <MsgBoxConstants.au3> #include <Array.au3> #include <String.au3> #include <Excel.au3> Local $oIE = _IECreate("http://website") _IEAction($oIE, "invisible") Local $oForm = _IEFormGetObjByName($oIE, "maintenanceForm") $oQuery = _IEFormElementGetObjByName($oForm, "theFile") _IEAction($oQuery, "focus") _IEAction($oQuery, "selectall") Local $hIE = _IEPropertyGet($oIE, "hwnd") ControlSend($hIE, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "This works") _IEAction($oIE, "visible") sleep(1000) Send ("C:\upload.txt") sleep(1000) Send ("{ENTER}") _IEAction($oQuery, "focus") Send ("{TAB}") Send ("{ENTER}") local $source = _IEBodyReadText($oIE) local $file = FileOpen("test.txt", $FO_OVERWRITE) FileWrite($file,$source) FileClose($file) local $success = _StringBetween($source, "File has "," successfully") #include "UIAWrappers.au3" If @error then ;~ *** Standard code maintainable *** AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("Global.Highlight", False) _UIA_setVar("oP1","Title:=Management System - Internet Explorer;controltype:=UIA_WindowControlTypeId;class:=IEFrame") ;Management System - Internet Explorer _UIA_setVar("oP2","Title:=;controltype:=UIA_PaneControlTypeId;class:=Frame Notification Bar") ; _UIA_setVar("oP3","Title:=Notification;controltype:=UIA_ToolBarControlTypeId;class:=DirectUIHWND") ;Notification ;~ $oUIElement=_UIA_getObjectByFindAll("Cancel.mainwindow", "title:=Cancel;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=Cancel;controltype:=UIA_ButtonControlTypeId;class:=") ;ControlType:=UIA_ButtonControlTypeId;classname:=") ;~ Actions split away from logical/technical definition above can come from configfiles ;~_UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") ;~_UIA_Action("oP2","highlight") _UIA_Action("oP2","setfocus") ;~_UIA_Action("oP3","highlight") _UIA_Action("oP3","setfocus") _UIA_action("oUIElement","highlight") _UIA_action("oUIElement","click") MsgBox(4096, 'Needle in a Haystack', "Failed") ElseIf $success[0] = "uploaded" Then MsgBox(4096, 'Needle in a Haystack', $success[0]) EndIf _IEQuit($oIE)
-
OutlookEX UDF - Help & Support (IV)
cheesestain replied to water's topic in AutoIt General Help and Support
After struggling for a while, I was able to get _OL_ItemMove to work. However, I want to understand why what I did worked. Old Code $TargetFolder = _OL_FolderAccess($oOutlook,"First.Last@Company.com\Inbox\Processed",$olFolderInbox) $oItem = _OL_ItemMove($oOutlook, $aItems[1][2], Default, $TargetFolder) Working Code $TargetFolder = _OL_FolderAccess($oOutlook,"First.Last@company.com\Inbox\Processed",$olFolderInbox) $oItem = _OL_ItemMove($oOutlook, $aItems[1][2], Default, $TargetFolder[1]) I didn't know $TargetFolder was an array. Also, I don't understand why it's [1]. When I display the array the target folder shows up on row 5. -
cheesestain reacted to a file: OutlookEX
-
_IEFormElementSetValue using array
cheesestain replied to cheesestain's topic in AutoIt General Help and Support
Thank you! It worked!