Jump to content

OOo/LibO Calc UDF


GMK
 Share

Recommended Posts

I don't believe that option is possible with OOo because OOo's interface doesn't support it.

 

Ah, thats a disappointment...

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Link to comment
Share on other sites

 

BrewManNH, on 18 Dec 2013 - 8:11 PM, said:snapback.png

 I don't believe that option is possible with OOo because OOo's interface doesn't support it.snapback.png

 

If you had studied the AOO API documentation you will find that there are many 'properties' that can be utilised.

The code below originally by LEAGNUS, has been adapted by me, works just how I need.

#cs
  FileName: RunOOoCalc.au3
  Description: Run a Calc file 'hidden'
    
#ce

#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Add_Constants=y
Opt ("WinTitleMatchMode",4)
Opt("TrayIconHide", 1) ;0=show 1=hide
Opt('TrayAutoPause', 0) ;0=no pause 1=pause
#Include <Array.au3>

_Run_OOoCalc()

;===============================================================================
;
; Function Name:    _Run_OOoCalc()
; Description:      Opens a Scalc workbook and returns its object identifier.
; Parameter(s):     $fn   = full UNC File Name of the workbook file
; Requirement(s):   AutoIt3 with COM support (post 3.1.1)
;                   On Success - Returns an object variable pointing to
;                           active com.sun.star.frame.Desktop Component object
;                   On Failure  - Returns 0 and sets @ERROR = 1
; Author(s):        Leagnus
; Adapted by:       Code Mehomic (6 Jan 2011)
; Added:            The AOO API 'hidden' properties to the open spreadsheet (display 'hidden')
;===============================================================================
;
Func _Run_OOoCalc()
   Local $oDesktop, $f_num
   Local $OpenPar[2] ;<< set array
   $OpenPar[0] = _setProp("ReadOnly", False) ;<< set to true for read only
   $OpenPar[1] = _setProp("Hidden", True) ; <<-- set to false to make visible
   $oSM = Objcreate("com.sun.star.ServiceManager") ;<< create the service manager
   $oDesktop = $oSM.createInstance("com.sun.star.frame.Desktop")   ;<< create a desktop object:
   $oCurCom = $oDesktop.loadComponentFromURL( "private:factory/scalc", "_blank", 0, $OpenPar) ;<< create blank document
   if @error or Not IsObj($oCurCom) then
      SetError(1, 0, 0)
   else
      Return
 EndIf
EndFunc

;------------------------------------------------------------------------------------------
; Function Name:    setProp()
; Description:      Function to set properties of the OOo service Manager
; Requirement(s):   AutoIt3 with COM support (post 3.1.1)
;                   On Success - Returns an object variable pointing to
;                                     active com.sun.star.frame.Desktop Component object
;                   On Failure  - Returns 0 and sets @ERROR = 1
; Author(s):        Leagnus
; ----------------------------------------------------------------------------------------
 Func _setProp($cName, $uValue)
 Local $oPropertyValue
 Local $oSM, $setOOoProp
  $oSM = Objcreate("com.sun.star.ServiceManager") ;<< create the service manager
  $oPropertyValue = $oSM.Bridge_GetStruct("com.sun.star.beans.PropertyValue") ;<< create the property value
  $oPropertyValue.Name = $cName 
  $oPropertyValue.Value = $uValue
  $setOOoProp = $oPropertyValue ;<< create 'name=value' pairs
  Return $setOOoProp
EndFunc
;
; --------------------------------------- end of file ----------------------------------------------------
;

Enjoy.......

Merry Christmas and a Happy New Year to all.

Code Mehomic

Edited by Mehomic
Link to comment
Share on other sites

Sorry, but I did say "I don't believe" which would imply that I wasn't sure from what I read. If there's a way to do, that's nice to know.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I tried simply replacing "Password" with "Hidden" in the OOoCalc UDF and that failed

This is what i tried and it failed:

Func _OOoCalcBookOpen($sFileName, $fReadOnly = False, $sHidden = True)
    Local $sFuncName = "_OOoCalcBookOpen"
    If Not IsString($sFileName) Then
        __OOoCalcErrorNotify("Error", $sFuncName, "", "$_OOoCalcStatus_InvalidDataType - File name must be a string")
        Return SetError($_OOoCalcStatus_InvalidDataType, 1, 0)
    EndIf
    If Not FileExists($sFileName) Then
        __OOoCalcErrorNotify("Error", $sFuncName, "", "$_OOoCalcStatus_NoMatch - File could not be found")
        Return SetError($_OOoCalcStatus_NoMatch, 1, 0)
    EndIf
    If Not IsBool($fReadOnly) Then
        __OOoCalcErrorNotify("Error", $sFuncName, "", "$_OOoCalcStatus_InvalidDataType - Read-only flag must be True or False")
        Return SetError($_OOoCalcStatus_InvalidDataType, 2, 0)
    EndIf
    If Not IsBool($sHidden) Then
        __OOoCalcErrorNotify("Error", $sFuncName, "", "$_OOoCalcStatus_InvalidDataType - Password must be a string")
        Return SetError($_OOoCalcStatus_InvalidDataType, 3, 0)
    EndIf
    Local $oSM = ObjCreate("com.sun.star.ServiceManager")
    If Not IsObj($oSM) Then
        __OOoCalcErrorNotify("Error", $sFuncName, "", "$_OOoCalcStatus_GeneralError - Unable to create service manager object")
        Return SetError($_OOoCalcStatus_GeneralError, 0, 0)
    EndIf
    Local $oDesktop = $oSM.createInstance("com.sun.star.frame.Desktop")
    If Not IsObj($oDesktop) Then
        __OOoCalcErrorNotify("Error", $sFuncName, "", "$_OOoCalcStatus_GeneralError - Unable to create desktop instance")
        Return SetError($_OOoCalcStatus_GeneralError, 0, 0)
    EndIf
    Local $sURL = __OOoCalcFileToURL($sFileName)
    Local $aoProperties[1] = [__OOoCalcSetPropertyValue("ReadOnly", $fReadOnly)]
    If Not IsObj($aoProperties[0]) Then
        __OOoCalcErrorNotify("Error", $sFuncName, "", "$_OOoCalcStatus_GeneralError - Unable to set read-only properties")
        Return SetError($_OOoCalcStatus_GeneralError, 0, 0)
    EndIf
        ReDim $aoProperties[2]
        Local $aoProperties[1] = [__OOoCalcSetPropertyValue("Hidden", $sHidden)]
        If Not IsObj($aoProperties[1]) Then
            __OOoCalcErrorNotify("Error", $sFuncName, "", "$_OOoCalcStatus_GeneralError - Unable to set hidden properties")
            Return SetError($_OOoCalcStatus_GeneralError, 0, 0)
        EndIf
    Local $oReturn = $oDesktop.loadComponentFromURL($sURL, "_default", 0, $aoProperties)
    If Not IsObj($oReturn) Then
        __OOoCalcErrorNotify("Error", $sFuncName, "", "$_OOoCalcStatus_GeneralError - Unable to load compoment from URL")
        Return SetError($_OOoCalcStatus_GeneralError, 0, 0)
    Else
        Return SetError($_OOoCalcStatus_Success, 0, $oReturn)
    EndIf
EndFunc   ;==>_OOoCalcBookOpen
Edited by Wombat

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Link to comment
Share on other sites

  • 1 year later...

so far I have this UDF working easily, however when I use: _OOoCalcReadCell it is copying the formulas from the cells instead of the calculated values...

if I manually/physically (without the script) hit copy on a cell and then paste into notepad, it correctly copies the calculated value, how can i read/copy the value instead of the formula?

Edited by xekon
Link to comment
Share on other sites

  • 2 weeks later...

Sorry for the delay--I don't get on here as much anymore.  There are multiple ways we could get around this.  We could change line 1380 to read ".getValue" instead of ".getFormula".  (Another option there would be to add a parameter to the function asking whether to read formula or value.)  We could also use _OOoCalcReadSheetToArray to read the value(s).

Additional feedback would help to decide how to move forward if I'm to update any functions.

Edited by GMK
clarification
Link to comment
Share on other sites

... Additional feedback would help to decide how to move forward if I'm to update any functions.

What is the need for Func _OOoCalcBookNew() to create a default sheet as ReadOnly ?
I had to change that to have a functional demo.
A small change like Func _OOoCalcBookNew( $fReadOnly = False ) would be better :)

Thanks for putting this together and do continue if you have the time :D

 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

rather script breaking change

just FunctionNames renaming 

_OOoCalc_BookNew
_OOoCalc_BookOpen
_OOoCalc_BookAttach
_OOoCalc_BookSaveAs
_OOoCalc_BookClose
_OOoCalc_WriteCell
_OOoCalc_WriteFormula
_OOoCalc_WriteFromArray
_OOoCalc_HyperlinkInsert
_OOoCalc_RangeMoveOrCopy
_OOoCalc_CreateBorders
_OOoCalc_NumberFormat
_OOoCalc_ReadCell
_OOoCalc_ReadSheetToArray
_OOoCalc_RowDelete
_OOoCalc_ColumnDelete
_OOoCalc_RowInsert
_OOoCalc_ColumnInsert
_OOoCalc_SheetAddNew
_OOoCalc_SheetDelete
_OOoCalc_SheetNameGet
_OOoCalc_SheetNameSet
_OOoCalc_SheetList
_OOoCalc_SheetActivate
_OOoCalc_SheetSetVisibility
_OOoCalc_SheetMove
_OOoCalc_SheetPrint
_OOoCalc_HorizontalAlignSet
_OOoCalc_FontSetProperties
_OOoCalc_CellSetColors
_OOoCalc_RowSetColors
_OOoCalc_ColumnSetColors
_OOoCalc_RowSetProperties
_OOoCalc_ColumnSetProperties
_OOoCalc_FindInRange
_OOoCalc_ReplaceInRange
_OOoCalc_ErrorHandlerRegister
_OOoCalc_ErrorHandlerDeRegister

 

EDIT: But this should wait for any other bigger changes like rewrite.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Does this work for anybody with 64-bit LibreOffice5?

I have 64-bit Win10 + 64-bit LO and connection doesnt work. 64-bit Win10 + 32-bit LO works perfectly.

Problem may be in com.sun.star.ServiceManager DCOM, which is apparently run by 64bit soffice.exe and, as I understand, cant be reached by 32bit AutoIt, even if I use 64bit Script Runner.

I experimented with adding com.sun.star.ServiceManager into WOW6432Node parts of registy, but with no luck.

Any comments?

 

 

 

Link to comment
Share on other sites

  • 6 months later...

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • 2 weeks later...

Dates don't play nicely. It adds a ' in front of the date rendering it useless.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
#include <OOoCalc.au3>

$Form1_1 = GUICreate("Notary Client Verification Form", 667, 273, 192, 132)
$Date1 = GUICtrlCreateDate(_DateToDayValue, 72, 40, 257, 25,$WS_TABSTOP)
$Button1 = GUICtrlCreateButton("OK", 8, 206, 649, 57)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $TheDate = GUICtrlRead($Date1)
            MsgBox(0,"",$TheDate)
            $OOspreadsheet = _OOoCalcBookNew()
            _OOoCalcBookSaveAs($OOspreadsheet,"C:\new.ods")
            _OOoCalcBookClose($OOspreadsheet)
            $OOspreadsheet = _OOoCalcBookOpen("C:\new.ods")
            Sleep(1000)
            _OOoCalcWriteCell($OOspreadsheet,$TheDate,"A1")
    EndSwitch
WEnd

Run and click ok to see error.

Link to comment
Share on other sites

64-bit update: I just upgraded to LibreOffice 5.2.0.4 x64  and it seems to work fine better. I'm still trying to get SaveAs to work properly.

@keafter, I'll check out your error and see what I can find. What version of OO/LO are you running?

Edited by GMK
Additional clarification needed; OK, maybe not fine, but better.
Link to comment
Share on other sites

I'm working on updating the _OOoCalcWriteCell functions, as well as the constants for _OOoCalcNumberFormat, which don't seem to match the documentation.

In the meantime, you can use _OOoCalcWriteFormula, then use _OOoCalcNumberFormat to format the cell as a date.

Edited by GMK
Mistyped function name.
Link to comment
Share on other sites

On 8/4/2016 at 1:56 AM, keafter said:

Dates don't play nicely. It adds a ' in front of the date rendering it useless.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
#include <OOoCalc.au3>

$Form1_1 = GUICreate("Notary Client Verification Form", 667, 273, 192, 132)
$Date1 = GUICtrlCreateDate(_DateToDayValue, 72, 40, 257, 25,$WS_TABSTOP)
$Button1 = GUICtrlCreateButton("OK", 8, 206, 649, 57)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $TheDate = GUICtrlRead($Date1)
            MsgBox(0,"",$TheDate)
            $OOspreadsheet = _OOoCalcBookNew()
            _OOoCalcBookSaveAs($OOspreadsheet,"C:\new.ods")
            _OOoCalcBookClose($OOspreadsheet)
            $OOspreadsheet = _OOoCalcBookOpen("C:\new.ods")
            Sleep(1000)
            _OOoCalcWriteCell($OOspreadsheet,$TheDate,"A1")
    EndSwitch
WEnd

Run and click ok to see error.

Update (see first post) and try this:

#include "OOoCalc.au3"
#include <Date.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

_OOoCalc_ComErrorHandler_UserFunction(_ErrFunc)

$Form1_1 = GUICreate("Notary Client Verification Form", 667, 273, 192, 132)
$Date1 = GUICtrlCreateDate(_DateToDayValue, 72, 40, 257, 25, $WS_TABSTOP)
$Button1 = GUICtrlCreateButton("OK", 8, 206, 649, 57)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $TheDate = GUICtrlRead($Date1)
            MsgBox($MB_ICONINFORMATION + $MB_TOPMOST, "Date", $TheDate)
            $sFileName = @MyDocumentsDir & "\new.ods"
            If FileExists($sFileName) Then FileDelete($sFileName)
            $OOspreadsheet = _OOoCalc_BookNew()
            Sleep(1000)
            _OOoCalc_WriteCell($OOspreadsheet, $TheDate, "A1")
            _OOoCalc_NumberFormat($OOspreadsheet, 36, "A1")
            _OOoCalc_BookSaveAs($OOspreadsheet, $sFileName)
            _OOoCalc_BookClose($OOspreadsheet)
            $OOspreadsheet = _OOoCalc_BookOpen($sFileName)
    EndSwitch
WEnd

; User's COM error function. Will be called if COM error occurs
Func _ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...