User avatar
LeftoverBeefcake

Posted Tue Feb 23, 2021 11:04 am

Is it possible to get data from your modern web apps and use it in your 30+ year old Amiga software?

My belief is: YES! (as long as it's not encrypted...)

Like many applications on the World Wide Web, Google Calendar has what's called an Application Programming Interface (API) that allows people to work with the app using the programming language of their choice. This API allows you to grab data, in this case from your online calendar, and work with it in a way that's more flexible and beyond what the Google developers were able to do. For example, if there's another online app (with its own API) from Hallmark that lets you send out cards for special occasions, you can create your own program to take the calendar data from Google and send it to Hallmark to automatically send out cards to friends and family and keep everything up to date.

Okay, great, so we can get data from our modern, always-online web applications to use elsewhere. Now what happens if we want to use the data in an old piece of software that doesn't have an API, doesn't have a way to import data from other sources, or doesn't even have the source code available to see how its data files are even put together? Well, we're gonna have to use some tools to pry open the mystery box that is that old software to see how everything works, so hopefully we can reproduce what it needs using some programming and make everything fit together. And the mystery box we are working with is Word Perfect Library from the Word Perfect Corporation, created in 1989.
IMG_20210223_121923671.jpg
With a hex editor, let's take a look at the data file that Word Perfect Library (WPL) generates. Weirdly enough, a LOT of it is empty space. From my understanding, at the top of a file is usually a header so that the operating system knows what kind of file it's dealing with. Then the rest of the file is usually structured in some predictable pattern so that it's easy for the programmer to use the data inside the application.

Each WPL data file is roughly the same for about 515 bytes and then it stores appointment, todo, and memo text data at the bottom of the file. By comparing multiple files and looking for what's changed, we can roughly determine what data gets stored at what location. From there we can use the Amiga WPL file as a template, only we'll replace the WPL generated data and fill in the data from our Google Calendar using the PHP programming language. But hey, why not go the other way and load up a Google Calendar with data from our WPL file once we know how everything works? We can (eventually) do that, too!
IMG_20210223_115241847.jpg
IMG_20210223_115320586.jpg
So this is where I've gotten to so far... I intend to create more WPL files to see where everything gets stored (and how dates are stored since there are many formats dates can be written in), and then I will read those files into a PHP program stored on my web server, add my own data into them, write them back out again, and see if WPL can read them without issue. Stay tuned for more!

User avatar
intric8
Seattle, WA, USA

Posted Tue Feb 23, 2021 12:05 pm

This is SO exciting! I can't wait to see what you unearth from the ancient software burial ground that is WP Library.

I do know there is a "Format" menu that allows you to modify the Date and Time formats in very intricate ways through a sort of numerical code, but I imagine those are conversions calculated entirely at the front-end. I'd be surprised if they manipulated how the dates are stored in the database file. Let's hope that doesn't complicate things. I just use the built-in defaults.
IMG_2038.JPG
IMG_2037.JPG

Good luck! This would be so cool if you figure it out!

User avatar
LeftoverBeefcake

Posted Tue Feb 23, 2021 3:54 pm

You just helped figure out another portion of the file, because it looks like that formatting data is being stored directly. Thanks! :lol: There's gotta be other stuff in the WPL program preferences that I haven't set that probably go in there as well... I'll just keep those date settings as the "defaults" then.
IMG_20210223_174320215.jpg

User avatar
LeftoverBeefcake

Posted Thu Feb 25, 2021 8:35 pm

Getting so, so close...

First, I created a "template" WPL file on the Amiga, and entered things like ##MEMO##, ##TODO##, etc. in the memo, appointment, and to-do windows so I could easily identify the parts to be replaced with test information that I would enter using a form on my local web server. (Later on this test information will instead be directly imported from Google Calendar.)
wpl_02.jpg
I also created a simple hex dumper to look at the WPL test file in hexadecimal on the web, and compared it to what was being shown in FileX on the Amiga, to confirm that both files were exactly the same and that my PHP program was interpreting the file correctly when it loaded the file in (which it was).
wpl_03.jpg
wpl_04.jpg
I then loaded and split up the original template file, replacing the ## marked parts with my test info, pieced the file back together again, and wrote it back out in binary. Then using FTP I brought it into the Amiga from my Mac so it would be read by Word Perfect Library. Unfortunately, it would not accept the file, giving me an error stating it was not a Calendar file. D'oh! WPL asks for a time when entering an appointment, and a priority number when asking for a to-do item, perhaps I am missing those, or it might be something else... Back to studying the data files again...
wpl_05.jpg
[edit] One oopsie was a typo in my PHP code that generates the new data file... now fixed. However , I went back to WPL and entered the exact info into it that I used on the web ("here is a memo!" etc.) and saved out the data file again, and noticed there were some small differences when compared to each other. So I edited the web-generated file to match the Amiga generated one, and now it works! One strange thing is that when you're editing your information on the Amiga and the text happens to wrap to the next line in the window, it sticks something other than a space in between the old line and the new line (probably a newline or carriage return character) so I'm probably going to have to count how many characters will fit in a window and make sure the imported Google Calendar data breaks at that point. Really weird.

User avatar
McTrinsic

Posted Thu Feb 25, 2021 10:27 pm

Awesome, keep up the great work!! Really curious where this may lead. It feels like watching Indiana Jones find some stuff that can be used nowadays. Really cool.

User avatar
intric8
Seattle, WA, USA

Posted Fri Feb 26, 2021 10:01 am

Utterly fascinating. This is just so cool how close you seem to be!

I can say from my Wordprocessor tests that there does seem to be quite a bit of character and space encoding/decoding hocus pocus when you try to share files between a Mac and an Amiga. To that end, thanks to Time Machine and Spotlight, the modern Mac with create a ton of really annoying files for everything you ever attach. They start with a "._" and can become super annoying.

In any case, sounds like you're on the right track now. Holy smoke LBC!

User avatar
LeftoverBeefcake

Posted Sun Feb 28, 2021 6:21 pm

I'd like to report SUCCESS!!! After a lot of head scratching, and many many many cups of coffee, the Word Perfect Library gave up enough of its secrets to allow me to piece together a working data file. There are still a few spots in the beginning of the file where I'm still not sure what is being stored, and I'm only working with *one* memo, *one* appointment, and *one* to-do entry so far, and there's absolutely no error checking when creating the file... but it works! 8-)

Took a screenshot on the Amiga so I could make some notes regarding what I was seeing in the file in Personal Paint:
IMG_20210228_193007704.jpg
I had to break down the data into more pieces than what I had initially, because of the many different spots where the various bits of information was being stored. Also I had to expand my hex dump so I could see the original and new files side by side.
IMG_20210228_193046526.jpg
Right from the web with NO ERRORS when the file imports!
IMG_20210228_193732054.jpg
The next step is to get connected with Google Calendar and work out how to grab the data, and also figure out time and date formatting. Events on Google will most likely turn into Appointments on Amiga, Tasks will become To-Do, and any comments will fit into the Memo field. Reminders/Alarms, etc. will be tackled at a later time... I just want to get an overall structure in place before working on the finer details. After that is setting up the "BBS" that you can Telnet into using a terminal program, and grab your Google data to download it straight to your Amiga via XMODEM and import it into Word Perfect Library.

User avatar
obitus1990
USA

Posted Sun Feb 28, 2021 8:07 pm

Wow, that's so cool!

BTW, are you the same LeftoverBeefCake that shared his C64 case clip repair files on Thingiverse? If so, thank you very much, as I've used them many times to fix broken cases :)

User avatar
LeftoverBeefcake

Posted Tue Mar 02, 2021 6:01 pm

obitus1990 wrote:
Sun Feb 28, 2021 8:07 pm
BTW, are you the same LeftoverBeefCake that shared his C64 case clip repair files on Thingiverse? If so, thank you very much, as I've used them many times to fix broken cases :)
Yup, that's me! That's awesome, I'm glad the files could be of help! I just wish I had known about the size differences in the tabs since on some cases the tabs are less wide. I think there's a remix that addresses that, though.

User avatar
LeftoverBeefcake

Posted Thu Mar 04, 2021 8:50 pm

Just a heads-up at this point in time that I now have a website at http://www.leftoverbeefcake.com since Google wants stuff accessing their calendar data to be hosted on a secure site... hopefully I have set up my site's SSL certificate correctly... :oops:

BTW if the site ends up looking weird in a modern browser, it's because I want to make it as Amiga-friendly as possible, so folks can visit using AWeb, iBrowse, etc. I'm hoping to make any images on it quite viewable even on an OCS/ECS machine. There's not much up there yet, but I'll be adding to it in the coming days as time/work allows.





Return to “The Lounge”