Jump to content

OOo COM UDF


Leagnus
 Share

Recommended Posts

Though "COM" is not exact what OOo services are – I've given the name for easy searchin through plenty of themes.

May be OOoUNO_UDF is better?

Basic functions to use Open Office Calc in AutoIt scripts :P .

OOoCOM_UDF.au3

OOoCOM_UDF.au3

Feel free to post here a bug or proposition .

Tested with OOo 3.0.1.

For testing you can use xls-file

import.zip

Example scripts are:

OpenOffice_Examples.zip

Big thanks to SEO <locodarwin at yahoo dot com> for ideas in ExcelCOM_UDF.au3

Edited by Leagnus
Link to comment
Share on other sites

Though "COM" is not exact what OOo services are – I've given the name for easy searchin through plenty of themes.

Thanks....and I will be keeping an eye out for later versions. As I will be eagerly awaiting additional options such as the Excel sheet equivalents for use in OO

I use:

_ExcelReadArray

_ExcelSheetUserdRangeGet

_ExcelBookOpen

Having the OO equivalent of these would let users who don't have excel installed (all non management users) use my program v. it being management only.

Thanks again.

Link to comment
Share on other sites

Glad to see this UDF!

First suggestion: Drop the idea of making changes to Global options in a UDF:

Opt("WinTitleMatchMode", 4)

If your function really depends on that mode being set, then that function should change it, saving the old value, and restore it before returning. Make a global change that will be left to affect the rest of the script is bad UDF citizenship.

In addition, mode 4 methods work by default in the current versions of AutoIt.

In addition to the addition, all the UDFs are usually grouped at the top of the script, before any other code, so if the script changes the mode, this line won't help.

:P

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 2 months later...

Added _OOoRead2Array() function, that creates an array from specified range of specified worksheet.

For searching data this func 8x faster then using _OOoCalc_FindInRange.

Thanks to PsaltyDS for note about Opt("WinTitleMatchMode", 4).

Edited by Leagnus
Link to comment
Share on other sites

  • 1 month later...

Even before actually using this, I get this error:

C:\Program Files\AutoIt3\Include\OOoCOM_UDF.au3(102,30) : WARNING: $FFile: possibly used before declaration.
      $cURL = Convert2URL($FFile)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\OOoCOM_UDF.au3(102,30) : ERROR: $FFile: undeclared global variable.
      $cURL = Convert2URL($FFile)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\OOoCOM_UDF.au3 - 1 error(s), 1 warning(s)

I haven't actually used it in my script... this happens simply after including it.

Link to comment
Share on other sites

  • 6 months later...

I believe you need to edit the UDF file and fix what looks like a typo maybe, about line 93 I think.

change it to:

Func _OOoCalc_Open($FFile)

This change hasn't broken the supplied examples that I have found.

If there is no change, I think $FFile needs to be defined in the calling functions and be available from outside the function in the UDF.

HTH

myids

Link to comment
Share on other sites

I believe you need to edit the UDF file and fix what looks like a typo maybe, about line 93 I think.

change it to:

Func _OOoCalc_Open($FFile)

This change hasn't broken the supplied examples that I have found.

If there is no change, I think $FFile needs to be defined in the calling functions and be available from outside the function in the UDF.

HTH

myids

You're confused. The parameter variables in a function declaration are used to pass values INTO the function and are automatically declared Local to that function. Look at all the function declarations in the various other UDFs for examples, and review the help file under Func.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 4 months later...

I've been trying to work with this and similar UDFs to automate OpenOffice, but I'm finding that the setProp function does not seem to work. For example, setting $OpenPar to "ReadOnly" has no effect, and as far as I can determine, the same is true for all parameters set by this function.

I have tried essentially the same function in Visual Basic, and it works, so it doesn't seem to be a problem with my installation of Open Office. I have also tried with a much earlier version of AutoIt3, with the same result.

I note that at least an earlier version of a similar UDF sets the parameter with:

$OpenPar[0] = _ArrayCreate(setProp("ReadOnly", True))

{_ArrayCreate is an apparently depreciated function in the Array UDF). This does not seem to make any difference.

What am I missing? I am by no means clear on how these object programming needs are implemented in Autoit, so I'd be grateful for any clarification/

Thanks

Chris

Link to comment
Share on other sites

I've done a little more investigation into the problems of passing the parameters. It seems that there is no problem in passing strings (e.g. "Password"); I have not yet tested passing integers. But there is clearly a problem in passing Booleans.

If $uValue is passed as True (without quotes), this is passed to MakePropertyValue as a Boolean, but $oPropertyValue.Value remains False; it is not possible to change it to True. If it is passed as "True" (with quotes), it is passed as a string, is stored as a string with value "True', but this has no effect on the result of loadComponentFromURL.

I have tried passing the parameter as an integer with value 1 or value 127 (since OO stores Booleans as 2 bytes, with True non-zero), but this still has no effect. I'm running out of ideas.It does not seem passible for this routine to pass a parameter with value True. As I say, VBS has no problem.

Anyone offer any help?

Chris

Link to comment
Share on other sites

Try integer -1 for 'True', it has worked in some other instances where the exact value of 'True' was an issue when translating VBScript to AutoIt.

:mellow:

Edit: Even better answer from Dale Hohm.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 2 months later...

You're confused. The parameter variables in a function declaration are used to pass values INTO the function and are automatically declared Local to that function. Look at all the function declarations in the various other UDFs for examples, and review the help file under Func.

;)

By the way I have resolved the warning with $FFile altering the original UDF .

I simply have declared the variable in the udf, so

Global $FFile

Is this a good practise ?

And I am a bit confused for determine the last version of OOoCom_udf.au3 .

In the developer chat link to thread

there is another udf OOo_COM_UDF_v08.au3 named V08.

That UDF compiles with no warnings but I am not able to use it (see my post in that thread) , and some funcS are different.

I think is time to make order in the OpenOffice's udf.

Greetz (and pardon my poor english)

Link to comment
Share on other sites

  • 5 weeks later...

hello,

First great work and thanks for this marvelous UDF!

However i'm very interesting in the following functions :"save as" as in excel_udf, for example:

_ExcelBookSaveAs($infos_parc,$fichier_modele, 0, 1,"", "",1, 2)

And open a calc document by way invisible

_OOoCalc_Open

Is it possible ?

help please and sorry for my bad english,i'm french ;)

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...