Reading data from another app

petehilljnr

Registered User.
Local time
Today, 08:04
Joined
Feb 13, 2007
Messages
192
Ok - slightly different post here but I'll chuck it out there like a fishing line and see if anyone has an opinion or idea. Moderators feel free to move this if required.

I work with road condition data. We have a lot of information with regards to the attributes at given intervals down a road e.g. how rutted is it, how rough is the road etc etc. I have the information I require in tables in Access (2003).

Through a third party, we also have videos of the roads and a Java application that plays the video for us and shows us how far down the road the video is.

What I was hoping to do (as a test) was read the displacement (how far down the road) from the control in the Java app and display the appropriate information in a form in Access (for the time being).

So - the first thing I want to do is to make sure I can do that step; reading from another application.

I thought a starting point would be to use APIs in VBA to query the other app.

I started by downloading an app called WinID to query the Hwnd's of the windows and controls on the screen (quite handy!) but I ran into my first problem: Within the Java app, it seems to treat it as one entire control and I can't get the Hwnd of the control showing the displacement, only the Java window "SunAWTFrame"

With other windows (not Java) it seems to be ok - as in if I clicked into a normal windows app, I can get the Hwnd.

If anyone has any ideas, suggestions, or even possible solutions(!) they would be greatly appreciated. It is just an idea at the moment. Solving (or not solving) this problem would decide whether it's a goer or not.

I do have the option of controlling the video by creating my own video player which I have done before, but solving this problem would be better.

Regards,
Pete
 

MarkK

bit cruncher
Local time
Today, 08:04
Joined
Mar 17, 2004
Messages
8,186
Can you bypass the java app and connect to the data source that app uses? Where are the videos? On the internet? Where does the java app store the URLs?
Just a few thoughts,
Cheers,
 

petehilljnr

Registered User.
Local time
Today, 08:04
Joined
Feb 13, 2007
Messages
192
Yeah I can bypass it. What the video player application does is very simple. For each road there is a text reference file and related video file.

The text file contains the frame number and the chainage (distance down the road) that that frame is at. So - the video player plays the video and tells you what road you're on, and how far down the road the frame being displayed is (the chainage).

As the video plays, the chainage ticks over. There are the normal video controls (play, reverse, pause, fast forward, step +1 frame, step -1 frame).

It's the chainage (and the road) that I want to be able to read so I can display in my database a form showing relative attributes of that road and chainage. This would obviously tick over (on a timer) to read the chainage and update as required (well that was the plan anyway!). Basically what I want to do is automate the process of someone having to type the chainage into my app so they can see the road attributes at that chainage.

The video files and text reference files are stored on our local server, and the information about the roads (my info) is stored in a database on our server too.

The video player was developed by a 3rd party. It is an EXE, but I'm reasonably sure that it is Java based (I remember getting JAR files from them in an earlier version). Also, the class name of the window is "SunAWTFrame" which adds further weight.

I have developed my own video player before using the data and an ActiveX video control I bought of the internet. However, the existing Java based 3rd party product is a hell of a lot nicer and easier to use, and is also already installed on machines throughout our office and widely used and people already know it well. It is also used by parties outside of our company (not that I'd be pushing to use my app with those others, but it'd be nice to show off!!!)

Hence, it would be nice to try and create this based on reading the Java based existing application. However, it's being able to pull through the chainage from this from my Access app that is the problem (at the moment). It's hovering over the "too hard" basket at the moment.

Thanks for your reply so far.

Regards,
Pete
 

MarkK

bit cruncher
Local time
Today, 08:04
Joined
Mar 17, 2004
Messages
8,186
But you're running this under Windows right?
See if you can set a reference to any type libraries (tlb) or dlls that shipped with the custom software. Essentially you want to see if you can automate that software from VBA.
If you can't do that then I don't see how you can integrate their solution into yours or vice-versa.
You can create an Access form that hosts a web browser control. That browser can then display a page that contains a free media player, and your VBA can control that page--and thereby the media it displays.
Cheers,
 

c_smithwick

Underpaid Programmer
Local time
Today, 08:04
Joined
Jan 8, 2010
Messages
102
If I am reading you correctly it sounds like you need to determine what frame the video is currently on as a user is playing it, query the text file for the corresponding chainage data and plug that chainage data into your database to retrieve the corresponding road conditions. If that's the case then you only need to figure out how to retrieve the current frame number from the java applet. If the program is compiled and doesn't expose the frame number through some kind of API then you might be S.O.L. Does the current java video display the chainage location on the video as it's playing? Since you say it's drawing that data from a text file, chances are it is just delimited text. Perhaps you could edit/replace that text file from VBA and change the chainage data entries to a longer string with chainage data AND the text of your road conditions and then when the video played it would pull all the data from the text file and display the chainage data + road conditions on screen in "real time". Play around with that idea.
 

Users who are viewing this thread

Top Bottom