LibreOffice Calc - how to get a value of V2 cell in active sheet?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
lesiu
Posts: 1
Joined: 19 Sep 2021, 03:05

LibreOffice Calc - how to get a value of V2 cell in active sheet?

Post by lesiu » 19 Sep 2021, 03:39

Hi!
Is it posible to get a value of V2 cell in active sheet and prompt this in Mesage Box by AHK script?
User avatar
mikeyww
Posts: 26440
Joined: 09 Sep 2014, 18:38

Re: LibreOffice Calc - how to get a value of V2 cell in active sheet?

Post by mikeyww » 19 Sep 2021, 15:25

Code: Select all

SetTitleMatchMode, 2
If !WinExist("- LibreOffice Calc ahk_exe soffice.bin") {
 MsgBox, 48, Error, Calc is not open. Aborting.
 Return
} Else Clipboard := ""
RunWait, %ComSpec% /c WMIC path win32_process where name="soffice.bin" get Commandline |clip,, Hide
ClipWait, 0
If ErrorLevel {
 MsgBox, 48, Error, An error occurred while waiting for the clipboard.
 Return
} Else RegExMatch(Clipboard, """-o"" ""(.+?)""", p), XL := ComObjCreate("Excel.Application")
Try XL.Workbooks.Open(p1)
Try v2 := XL.Range("V2").Text
XL.Quit()
MsgBox, 64, V2, %v2%
This might fail if multiple documents are open. I have not tested that. Also: this method required opening the file such as from File Explorer, so that the command line contained the file's path. An alternative may be a LibreOffice API or library-- I believe posted on the forum.
Post Reply

Return to “Ask for Help (v2)”