Jump to content

How to read one Cell from Calc (Open Office)?


Martial
 Share

Recommended Posts

Hi,

 

as a beginner I have following question. Especially to Open Office.

 

 

$i=0

While $i<10

Sleep (3000)

 

ShellExecute ("C:\Users\xxx\Calc.ods")

Sleep(4000)

 

 

$i=$i+1

WEnd

 

 

I open the File Calc.ods with Open Office calc  (C:\Users\xxx\Calc.ods) and if cell A1 have value 1 then my AutoIt-Script should close this file. If A1 is not value 1 it should refresh (Send “^r“)

 

Hope you can help me.

 

 

Kind Regards

Martial

 

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

Did you have a look at the OpenOffice UDF?

Edited 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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

On 22.10.2018 at 8:55 PM, water said:

Welcome to AutoIt and the forum!

Did you have a look at the OpenOffice UDF?

Yes, I looked in it, but for a simple beginner like me too complicated. But Ive tried it:

From the help of the Demo (OooCalc_Demo) I would do this something like this:

_OooCalc_ReadCell should be important here

 

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7

#include <Array.au3>

#include <MsgBoxConstants.au3>

#include "OOoCalc.au3"

 

Opt("WinTitleMatchMode", 2)

_OOoCalc_ComErrorHandler_UserFunction(_ErrFunc)

 

ShellExecute ("C:\Users\xxx\Calc.ods")      ; open my main file from OOCalc

Sleep(4000)

 

If=1 _OOoCalc_ReadCell (0,0) Then              ; IF A1 = Value 1 --> Close my Calc.ods file

Send ("!{F4}")

Sleep (5000)

Else

Send “^r“     ; if not Value 1 ---->       refresh file

EndIf

 

; 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

 

Doesnt work, but would be nice if you could help me here :)

Link to comment
Share on other sites

I have never used OpenOffice Calc in combination with AutoIt.
But I think that if you have a look at OOoCalc_Demo.au3

You will see that function _OOoCalc_BookOpen, _OOoCalc_ReadCell and _OOoCalc_BookClose should do the trick.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...