Diary entries using OPL (2 line Organiser)

Use this section to showcase your programming examples. Or to ask members for programming suggestions
Post Reply
1333david
Posts: 66
Joined: Wed Jan 04, 2023 2:08 pm

Diary entries using OPL (2 line Organiser)

Post by 1333david »

Hi,
I was planning to write a program to add functionality to the Diary on my Psion XP. Initially to print the diary and add anniversary dates I have stored. So, each January I can run the program to add my birthdays etc for that year.
The printing part is easy as there is a program in the Psion newsletter (pdiary) which Peeks the location $2004 where the diary entries are stored. However, I'm not sure how best to add diary entries from OPL, or indeed, how the Psion handles diary entries.
If I add a new entry using the diary it doesn't seem to store this at the end of the location in the diary cell, but seems to sort them in date order. I'm therefore not sure if Pokeing after the last diary entry would work. If anyone has experience of adding diary entries using OPL I would be grateful for any tips.

Kind Regards,
David
User avatar
Martin
Global Admin
Posts: 475
Joined: Mon Jan 02, 2023 5:18 pm

Re: Diary entries using OPL (2 line Organiser)

Post by Martin »

Dave

Appendix B of the Diary Link Manual (here) explains the Format of a PC Diary.. This might be a solution to create your entries on a PC and (comms) Link them back on to the Organiser. I've attached a copy of the files that were on the Diary Link Floppy (diarylink.ZIP) just in case.

For HamLog on an LZ I created AdDate: (here) which you will see uses OPL to create a 'text' file in the correct LZ Diary format then enter the diary and Restore it.

Let me know how you get on.

Martin
.
diarylnk.zip
You do not have the required permissions to view the files attached to this post.
User avatar
Zenerdiode
Posts: 94
Joined: Wed Jan 04, 2023 12:45 am
Location: Newcastle, England

Re: Diary entries using OPL (2 line Organiser)

Post by Zenerdiode »

Trouble is, Martin, that David mentioned the XP…

Have a look at Tech-Ref Chapter 19 - Diary
and then Tech-Ref Chapter 12 - Filing System

I think you will have to create a Blockfile of type $82 with all of your entries in chronological order. Then manually Restore to the Diary. I scoured the Tech-Ref for a SWI that would do some of the heavy lifting for you - but there’s nothing for the XP. In Chapter 19 it mentions about entries being in chronological order to make OS searches for alarms more efficient; however it may work in random order without releasing the TRAP. :shock:

To do it all programmatically, you could create your Blockfile, calculate its size, grow the Diary cell, find its start position in memory and then poke your Blockfile sequentially. I’m reeling that there is no SWI to do this.
Christopher. - Check out my TRAP message, it’s not difficult to decode and is sometimes uttered under the breath when said message appears… :|
1333david
Posts: 66
Joined: Wed Jan 04, 2023 2:08 pm

Re: Diary entries using OPL (2 line Organiser)

Post by 1333david »

Thank you both for your comments they're much appreciated. I was hoping to just use the Organiser for storing and updating anniversaries (also tweeking the year so it appears correctly with Y2K fix), however Diary link was going to be my plan B.
The technical reference links are really useful and give me a much better understanding of how the Diary works and the complexities involved. I will explore both possibilities, but for now the Diary link looks the easiest :)
Kind Regards,
Dave
MartinP
Posts: 70
Joined: Wed Jan 04, 2023 7:51 pm

Re: Diary entries using OPL (2 line Organiser)

Post by MartinP »

1333David,
How did you get on with Diary Link?
This probably comes 3 months too late, but I've written an XP diary editor in OPL with functions to add and delete entries using a few OS calls that work directly on the diary allocator cell in RAM: al$grow, al$shrink and ut$cpyb

Adding a record in chronological order is done by searching through and comparing date and time to the new record. As Zenerdiode says, it's frustrating that there's no OS call that does it, but here the searching is done in OPL.

This project grew a bit out of control, and has become almost a replacement for the main Diary because of "feature creep". This diary editor DEDIT includes copying anniversaries to the following year, but not in bulk, although it could be done using FIND for some kind of identifying text. It works with Jaap's Y2K fix and is compatible with the main Organiser Diary.

I'm finding that a chronological diary list is quite useful, but I probably won't use it for everything. Oddly 'though, writing this has made me use my Google Diary more! So this diary add-on for the XP is probably 40 years too late, but hopefully it'll be useful for someone.

The files are at my GitHub here: https://github.com/martinprest/DEDIT

I've also attached a beta version of the OPK below and a snap for JAPE can be downloaded from my GitHub repository, above.
DEDIT_beta.OPK
Merry Christmas!
Martin P.
You do not have the required permissions to view the files attached to this post.
User avatar
Martin
Global Admin
Posts: 475
Joined: Mon Jan 02, 2023 5:18 pm

DEDIT

Post by Martin »

Martin... Very impressive..

I put some ANNIVersaries in (fine). Then main menu [Diary][Find] it displayed this years then END OF DIARY before finding next and subsequent years. I noticed your different * END of DIARY *

I got a 'flash' message about no. of records and something else! but can't make it happen again!

What about (in NEW or ANNIV) when setting time hh:mm if you press DEL it sets the clock to 00:00

Am I correct EXE steps though the whole Diary? and the up and down arrows step through only the ones in the future (for some reason except one)

Replace Y/N - very neat!

[Menu][Find] finds a blank entry or needs EXE to continue!

I'll play with it some more.

Martin

PS for other watching I use an Organiser Diary to record my 'on-line' transactions and keep a copy on RAM pack
MartinP
Posts: 70
Joined: Wed Jan 04, 2023 7:51 pm

Re: Diary entries using OPL (2 line Organiser)

Post by MartinP »

I suspect any records out of order might be due to not having Jaap's Y2K fix installed?

There are full instructions in the readme-DEDIT.txt

The 'flash' message seems like the info when EXE is pressed at the record indicator, first option in the menu. Pressing EXE again returns to the current record.

DEL to zero the time: are you suggesting a change that you'd like? Moving with left/right and typing over should work, so you can get 00:00 by pressing 0 four times.

EXE steps forward, B steps back, UP goes to first record, DOWN to the last.

Trying to find a null string by not entering a find string will result in a pause until EXE is pressed, that's a bug that could be fixed, but it's an odd thing I hadn't thought about. I suppose it should be like the main menu FIND and find everything, rather than nothing.

PS I probably should have said that DEDIT is for XP or CM only and running on an LZ will result in unpredictable behaviour because the Diary is stored differently on the LZ!
1333david
Posts: 66
Joined: Wed Jan 04, 2023 2:08 pm

Re: Diary entries using OPL (2 line Organiser)

Post by 1333david »

Hi MartinP,
Thank you so much for posting DEDIT, I find this really useful. I've made a few little tweaks to the version I'm using so the null string FIND now returns all records and there is the option to print the diary. Let me know if you'd like me to send it over to you.
All the best,
Dave
MartinP
Posts: 70
Joined: Wed Jan 04, 2023 7:51 pm

Re: Diary entries using OPL (2 line Organiser)

Post by MartinP »

Dave,
Glad you're making use of it, I removed the pause caused by searching for a null string, so now it just ignores a null search, that's the current version in my GitHub repo.
I wasn't sure about making a null string find everything, because that's what it does anyway (if you don't use FIND), also I wondered if I should make FIND the start of the program, like the FIND for records in Main on the Organiser's main menu (maybe call it DFIND instead of DEDIT) but I decided to leave it alone. Another tweak I considered was making the first record displayed the next one due, but again I just didn't do it.

I think the thing is that because the source code is all there, and in OPL, anyone can just tweak it to how they prefer it to work.

Your Print option sounds useful, I'd like to see that.
Martin P.
Post Reply