Rodger Posted May 17, 2019 Share Posted May 17, 2019 (edited) Hello, My company uses Outlook 2016 (Office 365). When I run the below script the line "$sCurrentUser = $oNameSpace.CurrentUser" gives a "2147467260" abort error back. #include "OutlookEX.au3" _OL_ErrorNotify(2) $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Outlook", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) If isObj($oOutlook) Then ConsoleWrite("OBJECT" & @CRLF) Else ConsoleWrite("NO OBJECT" & @CRLF) EndIf $oNameSpace = $oOutlook.GetNameSpace("MAPI") If @error <> 0 Then Exit MsgBox(16, "Outlook", "Namespace Error 2. @error = " & @error & ", @extended = " & @extended) If isObj($oNameSpace) Then ConsoleWrite("OBJECT" & @CRLF) Else ConsoleWrite("NO OBJECT" & @CRLF) EndIf $sCurrentUser = $oNameSpace.CurrentUser If @error <> 0 Then Exit MsgBox(16, "Outlook", "Namespace Error 3. @error = " & @error & ", @extended = " & @extended) If isObj($sCurrentUser) Then ConsoleWrite("OBJECT" & @CRLF) Else ConsoleWrite("NO OBJECT" & @CRLF) EndIf _OL_Close($oOutlook) Exit When I run this at home (Outlook 2019) the script works fine. Am I missing something ? Thanks for any feedback. Rodger Edited May 17, 2019 by Rodger Link to comment Share on other sites More sharing options...
water Posted May 17, 2019 Share Posted May 17, 2019 2147467260 (decimal) stands for: Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)). Does _OL_ErrorNotify provide any additional information? 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...
Rodger Posted May 17, 2019 Author Share Posted May 17, 2019 (edited) _OL_ErrorNotify give the below information; "Afgebroken" means aborted. Edited May 17, 2019 by Rodger Link to comment Share on other sites More sharing options...
Developers Jos Posted May 17, 2019 Developers Share Posted May 17, 2019 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
water Posted May 17, 2019 Share Posted May 17, 2019 It seems the script you posted above is not the same script that creates the MsgBox as there is only a "Namespace Error 2" and "Namespace Error 3" in the script you posted. Can you please post the script that corresponds to the MsgBoxes? 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...
Rodger Posted May 17, 2019 Author Share Posted May 17, 2019 #include "OutlookEX.au3" _OL_ErrorNotify(2) $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Outlook", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) If isObj($oOutlook) Then ConsoleWrite("OBJECT" & @CRLF) Else ConsoleWrite("NO OBJECT" & @CRLF) EndIf $oNameSpace = $oOutlook.GetNameSpace("MAPI") If @error <> 0 Then Exit MsgBox(16, "Outlook", "Namespace Error. @error = " & @error & ", @extended = " & @extended) If isObj($oNameSpace) Then ConsoleWrite("OBJECT" & @CRLF) Else ConsoleWrite("NO OBJECT" & @CRLF) EndIf $sCurrentUser = $oNameSpace.CurrentUser If @error <> 0 Then Exit MsgBox(16, "Outlook", "Namespace Error. @error = " & @error & ", @extended = " & @extended) If isObj($sCurrentUser) Then ConsoleWrite("OBJECT" & @CRLF) Else ConsoleWrite("NO OBJECT" & @CRLF) EndIf _OL_Close($oOutlook) Exit Link to comment Share on other sites More sharing options...
water Posted May 17, 2019 Share Posted May 17, 2019 I wonder if you still get the MsgBox from _OL_ErrorNotify stating the error occurred on line 31 - as this is the empty line before _OL_Close 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...
Rodger Posted May 17, 2019 Author Share Posted May 17, 2019 I had a lot of comments at the top which I removed from the code before inserting it in the topic. It does not change the errormessage, it still occurs at line: $sCurrentUser = $oNameSpace.CurrentUser Link to comment Share on other sites More sharing options...
water Posted May 17, 2019 Share Posted May 17, 2019 Quote My company uses Outlook 2016 (Office 365) We are talking about the on premise version, not the cloud version? 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...
Rodger Posted May 17, 2019 Author Share Posted May 17, 2019 It looks like my company does not allow any external program interacting with Outlook 2016 (Office 365). I tried the function : _OL_AccountGet($oOL) It fails on these two lines in the function : $aAccount[$iIndex][2] = $oAccount.SMTPAddress $aAccount[$iIndex][3] = $oAccount.UserName Link to comment Share on other sites More sharing options...
Rodger Posted May 17, 2019 Author Share Posted May 17, 2019 The only thing I know is that outlook is local on my desktop. Link to comment Share on other sites More sharing options...
water Posted May 17, 2019 Share Posted May 17, 2019 That's strange as _OL_Open as well interacts with Outlook and the first statement of your script that interacts with Outlook works too 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...
water Posted May 17, 2019 Share Posted May 17, 2019 Is Outlook already running when you start the script? If yes, could you please try and exit Outlook and let the script start Outlook in the background for you? 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...
water Posted May 17, 2019 Share Posted May 17, 2019 Do you run the 32 or 64 bit version of Office/Outlook? The AutoIt script should be compiled/run for the same bitness. 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...
Rodger Posted May 20, 2019 Author Share Posted May 20, 2019 I run the 32 bits version. If I don't start outlook and run the script, I get the below "Name unknown" error: Link to comment Share on other sites More sharing options...
water Posted May 20, 2019 Share Posted May 20, 2019 This message is expected an can be ignored. But the error message shows that you compile your AutoIt script for 64 bit. But it should be for 32 bit as your Outlook is 32 bit too. 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...
Rodger Posted May 20, 2019 Author Share Posted May 20, 2019 I compile it as 32bit. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "OutlookEX.au3" Link to comment Share on other sites More sharing options...
water Posted May 20, 2019 Share Posted May 20, 2019 (edited) Strange. The error message box says @AutoItX64 = 1. Edited May 20, 2019 by water 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...
jchd Posted May 20, 2019 Share Posted May 20, 2019 Yeah, but @Compiled = 0 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
water Posted May 20, 2019 Share Posted May 20, 2019 (edited) But the macro @AutoItX64 is described as: "Returns 1 if the script is running under the native x64 version of AutoIt." So my understanding is that the script is executed as X64. And I think this causes the problem we see. Edited May 20, 2019 by water 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...
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