User avatar
LeftoverBeefcake
Twitter

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
Website

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
Twitter

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
Twitter

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
Website

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!





Return to “The Lounge”