Page 1 of 1

HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 3:59 pm
by freewheeler
Interested to view the Hyp macros for learning purposes. Closest I can get to the macros is via:
Tools > Macros > Organize Macros > Python...
A "Python Macros" dialog appears. Various Hyp macros are listed (e.g. HypAddShareDlg) but all the dialog buttons (such as "Edit") are greyed-out. I have enabled macros (by setting security to "MEDIUM" as instructed in the User Guide, and also adding the sheet's folder to "Trusted File Locations"), so don't think that's anything to do with it.

HYPTUSS version is "Hyp Top-Up Version-b-u.ods"
LibreOffice version is 7.3.7.2
OS: Ubuntu

User Guide Appendix 1 refers to macro protection in Excel but can't find anything likewise for LibreOffice.

Re: HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 4:05 pm
by kiloran
freewheeler wrote:Interested to view the Hyp macros for learning purposes. Closest I can get to the macros is via:
Tools > Macros > Organize Macros > Python...
A "Python Macros" dialog appears. Various Hyp macros are listed (e.g. HypAddShareDlg) but all the dialog buttons (such as "Edit") are greyed-out. I have enabled macros (by setting security to "MEDIUM" as instructed in the User Guide, and also adding the sheet's folder to "Trusted File Locations"), so don't think that's anything to do with it.

HYPTUSS version is "Hyp Top-Up Version-b-u.ods"
LibreOffice version is 7.3.7.2
OS: Ubuntu

User Guide Appendix 1 refers to macro protection in Excel but can't find anything likewise for LibreOffice.

Open HYPTUSS with an archive software such as 7-zip, Winzip or whatever. When you've opened as an archive, the Python scripts are all in a single file Scripts/python/HypTopUp.py
LibreOffice does not have a built-in editor for Python scripts

--kiloran

Re: HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 4:10 pm
by XFool
...I don't know if this helps but, using LibreOffice 7.3.6.2 (x64) in Windows, when I select 'Organise Macros' I get the message:

"LibreOffice requires a 64-bit Java runtime environment (JRE) to perform this task. Please install a JRE and restart LibreOffice. https://hub.libreoffice.org/InstallJava/?LOlocale=en-GB "

As above, when I select 'Edit Macros', the LibreOffice Macro editor comes up in LibreOffice Basic.

Re: HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 4:18 pm
by freewheeler
kiloran wrote:Open HYPTUSS with an archive software such as 7-zip, Winzip or whatever. When you've opened as an archive, the Python scripts are all in a single file Scripts/python/HypTopUp.py


That worked!
So, .ods files are a ZIP archive. Good to know!

Thanks

Re: HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 4:21 pm
by kiloran
freewheeler wrote:
kiloran wrote:Open HYPTUSS with an archive software such as 7-zip, Winzip or whatever. When you've opened as an archive, the Python scripts are all in a single file Scripts/python/HypTopUp.py


That worked!
So, .ods files are a ZIP archive. Good to know!

Thanks

Good. Now treat me gently after you've ploughed through all 8.8k lines of code. I'm just a doddery old self-taught programmer :lol:
You'll probably cringe at some of the code

--kiloran

Re: HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 4:35 pm
by XFool
...kiloran, how did you get to learn about all the relevant functions (or whatever they are!) in LibreOffice etc. Is there some standard reference?

I remember some years ago, with Open Office, I borrowed some of your OO Basic code (for retrieving share prices) and adapted and 'neatified' it to my own requirements. It actually worked, though I didn't really have any proper understanding of OO Basic and its functions and programming.

But I didn't keep up with it. Though it must be lying around somewhere buried on some disc... Might even work with LibreOffice. :)

Re: HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 4:39 pm
by freewheeler
kiloran wrote:Now treat me gently after you've ploughed through all 8.8k lines of code. I'm just a doddery old self-taught programmer :lol:
You'll probably cringe at some of the code


Not at all, I'm finding my way around quite easily. The code confirms my suspicion that there's no way to import share data (e.g. yield) from Sharecast without having the share's "Sharecast CSI code". Was hoping there was a way to get it directly using the standard EPIC. Looks like I'll need to replicate (part of) your lookup table - "Company Data Sheet".

I should add, started looking at Sharecast as a source after finding yahoo.finance rather unreliable. And googlefinance doesn't offer yield.

Re: HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 5:12 pm
by kiloran
XFool wrote:...kiloran, how did you get to learn about all the relevant functions (or whatever they are!) in LibreOffice etc. Is there some standard reference?

I used some magical incantations and Google, supported by a lot of very naughty words which cannot be repeated here.

The standard Basic reference is:
https://books.google.co.uk/books?id=cHV ... &q&f=false
and I could then work towards python implementations.

Also:
https://forum.openoffice.org/en/forum/v ... 1290cf3370
https://ask.libreoffice.org/c/english/5
https://openoffice3.web.fc2.com/index.html
https://flywire.github.io/lo-p/
https://wiki.documentfoundation.org/Macros

The MRI and APSO extensions for LibreOffice also helped a lot

It's a long hard path! But infinitely better than using Basic within LibreOffice, especially for web scraping. And I could never have done it without Google

--kiloran

Re: HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 5:16 pm
by kiloran
freewheeler wrote:The code confirms my suspicion that there's no way to import share data (e.g. yield) from Sharecast without having the share's "Sharecast CSI code". Was hoping there was a way to get it directly using the standard EPIC. Looks like I'll need to replicate (part of) your lookup table - "Company Data Sheet".

HYPTUSS started out using the Sharecast CSI code, but this fell into disuse by Sharecast some years ago, so we evolved to using the Sharecast URL (well, URL suffix). I've never found a way to get the data using the EPIC (same for many other potentially useful websites)

--kiloran

Re: HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 5:23 pm
by XFool
Thanks, kiloran.

Re: HYPTUSS - How to view macro code in LibreOffice

Posted: April 5th, 2023, 8:31 pm
by kiloran
kiloran wrote:
XFool wrote:...kiloran, how did you get to learn about all the relevant functions (or whatever they are!) in LibreOffice etc. Is there some standard reference?

I used some magical incantations and Google, supported by a lot of very naughty words which cannot be repeated here.

The standard Basic reference is:
https://books.google.co.uk/books?id=cHV ... &q&f=false
and I could then work towards python implementations.

Also:
https://forum.openoffice.org/en/forum/v ... 1290cf3370
https://ask.libreoffice.org/c/english/5
https://openoffice3.web.fc2.com/index.html
https://flywire.github.io/lo-p/
https://wiki.documentfoundation.org/Macros

The MRI and APSO extensions for LibreOffice also helped a lot

It's a long hard path! But infinitely better than using Basic within LibreOffice, especially for web scraping. And I could never have done it without Google

--kiloran
I forgot about this stuff I put on our Financial Software site
http://lemonfoolfinancialsoftware.weebl ... mming.html

--kiloran