Donate to Remove ads

Got a credit card? use our Credit Card & Finance Calculators

Thanks to Wasron,jfgw,Rhyd6,eyeball08,Wondergirly, for Donating to support the site

HYPTUSS - How to view macro code in LibreOffice

Discussions regarding financial software
freewheeler
Posts: 16
Joined: April 16th, 2021, 11:52 am
Has thanked: 23 times

HYPTUSS - How to view macro code in LibreOffice

#580936

Postby freewheeler » April 5th, 2023, 3:59 pm

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.

kiloran
Lemon Quarter
Posts: 4112
Joined: November 4th, 2016, 9:24 am
Has thanked: 3254 times
Been thanked: 2856 times

Re: HYPTUSS - How to view macro code in LibreOffice

#580939

Postby kiloran » April 5th, 2023, 4:05 pm

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

XFool
The full Lemon
Posts: 12636
Joined: November 8th, 2016, 7:21 pm
Been thanked: 2609 times

Re: HYPTUSS - How to view macro code in LibreOffice

#580942

Postby XFool » April 5th, 2023, 4:10 pm

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

freewheeler
Posts: 16
Joined: April 16th, 2021, 11:52 am
Has thanked: 23 times

Re: HYPTUSS - How to view macro code in LibreOffice

#580943

Postby freewheeler » April 5th, 2023, 4:18 pm

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

kiloran
Lemon Quarter
Posts: 4112
Joined: November 4th, 2016, 9:24 am
Has thanked: 3254 times
Been thanked: 2856 times

Re: HYPTUSS - How to view macro code in LibreOffice

#580945

Postby kiloran » April 5th, 2023, 4:21 pm

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

XFool
The full Lemon
Posts: 12636
Joined: November 8th, 2016, 7:21 pm
Been thanked: 2609 times

Re: HYPTUSS - How to view macro code in LibreOffice

#580954

Postby XFool » April 5th, 2023, 4:35 pm

...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. :)
Last edited by XFool on April 5th, 2023, 4:41 pm, edited 1 time in total.

freewheeler
Posts: 16
Joined: April 16th, 2021, 11:52 am
Has thanked: 23 times

Re: HYPTUSS - How to view macro code in LibreOffice

#580955

Postby freewheeler » April 5th, 2023, 4:39 pm

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.

kiloran
Lemon Quarter
Posts: 4112
Joined: November 4th, 2016, 9:24 am
Has thanked: 3254 times
Been thanked: 2856 times

Re: HYPTUSS - How to view macro code in LibreOffice

#580970

Postby kiloran » April 5th, 2023, 5:12 pm

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

kiloran
Lemon Quarter
Posts: 4112
Joined: November 4th, 2016, 9:24 am
Has thanked: 3254 times
Been thanked: 2856 times

Re: HYPTUSS - How to view macro code in LibreOffice

#580971

Postby kiloran » April 5th, 2023, 5:16 pm

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

XFool
The full Lemon
Posts: 12636
Joined: November 8th, 2016, 7:21 pm
Been thanked: 2609 times

Re: HYPTUSS - How to view macro code in LibreOffice

#580977

Postby XFool » April 5th, 2023, 5:23 pm

Thanks, kiloran.

kiloran
Lemon Quarter
Posts: 4112
Joined: November 4th, 2016, 9:24 am
Has thanked: 3254 times
Been thanked: 2856 times

Re: HYPTUSS - How to view macro code in LibreOffice

#581018

Postby kiloran » April 5th, 2023, 8:31 pm

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


Return to “Financial Software - Discussion”

Who is online

Users browsing this forum: No registered users and 28 guests