Start a script seconds -after- a db field is completed

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
ZeitenWanderer
Pro Scripter
Posts: 68
Joined: Wed Dec 07, 2005 7:13 am

Start a script seconds -after- a db field is completed

Post by ZeitenWanderer » Thu May 29, 2008 11:09 am

Hi,

I need to start a script a few seconds after a db field is completed.

This is the purpose: I have a scale connected to a rs232 port, it delivers a final value once it is sure it has the proper weight. After the weight is stable for 5 secs it is considered to be the final one and is being sent via a program shipping with this scale right into a db field inside another application.

Now I would like to create a macro to find out when this db-field has recieved the data, since the scale-program does not deliver any documented option to give away a "successfully sent"-information, which I could pick up.

Thanks for any hints.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu May 29, 2008 3:12 pm

Macro Scheduler should be able to deal with this, many ways to attack it, but need more information about the application.

What database program are you using? What version?
Is it user programmable or can it create macros or can it shell out to DOS or call any scripts or batch files?

Is the data field with the weight visible so you can see if a value has been sent to it?
Can you program the db program to respond to a value in the field?
Can you read the database fields using ODBC/DDE/SQL or other tools?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

ZeitenWanderer
Pro Scripter
Posts: 68
Joined: Wed Dec 07, 2005 7:13 am

Post by ZeitenWanderer » Thu May 29, 2008 8:08 pm

Bob Hansen wrote:
What database program are you using? What version?
None, one would have heard about. Used years ago, but it is still good enough for the purpose.

Is it user programmable
More or less ....
or can it create macros or can it shell out to DOS or call any scripts or batch files?
No. :-)


[/quote]Is the data field with the weight visible so you can see if a value has been sent to it?[/quote]

Yes.


[/quote]Can you program the db program to respond to a value in the field?[/quote]
Well, it would not be worth the effort.


[/quote]Can you read the database fields using ODBC/DDE/SQL or other tools?[/quote]

No, I can export and import these formats, not work inside the living db using one of the typical tools.

This db is simply outdated, but I am very accustomed to it....
I thought about finally changing to SQL, but that takes some learning time, meanwhile I would need/want to go on (Antiquarian book business).

At the very worst, I would have to write (or rather modify) a tool to pick the values from the scale and write it directly into the field (without me being able to look at it without a refresh). That tool would be able to call a script then. Nevertheless, I had hoped to find an even quicker way. If there is none, well, then at least I haven`t wasted time for a silly attempt.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri May 30, 2008 3:52 am

1. I still support accounts with DOS databases from the 1980s. Again, what are you using, and version? Help may be available.

2. Since you can see the field change you may be able to use WaitWindowChanged or use the new ImageRecognition tools (CompareBitmaps) to note a change from a blank field.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

ZeitenWanderer
Pro Scripter
Posts: 68
Joined: Wed Dec 07, 2005 7:13 am

Database

Post by ZeitenWanderer » Fri May 30, 2008 7:02 am

Well, the database uses a proprietary format, it is a German tool called Datatron - and there is no support available for years. Not is it really needed. The question is sort of answered, means I know about the risks of wasting time, since there is no right away easy way.
I better switch to a compatible db system right away, accepting the learning time, but being better off at the end.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri May 30, 2008 7:05 pm

Does this not apply?
2. Since you can see the field change you may be able to use WaitWindowChanged or use the new ImageRecognition tools (CompareBitmaps) to note a change from a blank field.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

ZeitenWanderer
Pro Scripter
Posts: 68
Joined: Wed Dec 07, 2005 7:13 am

More info ...

Post by ZeitenWanderer » Fri May 30, 2008 9:00 pm

Hi Bob,

thanks for listening to a silly project. :-)

I had a look at the documentation for that scale device. The most important sentence is: "It puts [after a small setup] the measurements into any text-based app at the cursor position." Plus - "Define a hotkey to do this."
Now from this somehow new angle I would have two ways to proceed:

1: Start the script and run the scale-prog from inside and give it a certain bit of time (5 seconds or so), before the script marches on. (This second step would photograph the book from one or two sides.)
Would OnEvent also work? Run the scale-program and at the same time the script (held back for a few seconds)?

2: Use the way you suggested.

Despite that your way sounds more reliable, I believe at present this would not be worth the effort. For one thing I have several other tasks to fulfill and this db is just some kind of decent sandbox. On the other hand I started working with SQL Express in some other channel - that will take time, before I can make good use of that one.

What I like about this db today is it runs on old hardware (but it is still is a once loved, hardworked on, but finally silly outcome of a db-system).

Cheers

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts