Sign in to follow this  
Followers 0
Jefflas

Keep program & Script in Sync

7 posts in this topic

Hi,

I am trying to use AutoIT to automatically update an Accounting program.

Unfortuneately theScript runs ahead of the Accounting program causing the wrong value to be entered into the wrong field.

I cannot use WaitWinActive as the title, text and controls are the same for all the fields in the window.

I have tried using waitwinactive and setting the the Window Title to bring the script and progrram into sync.

So for example I have

WinSetTitle("OldTitle","Text","Field1")

WinWaitActive("Field1","text")

Send($field1)

WinSetTitle("Field1","Text","Field2")

WinWaitActive("Field2","text")

Send($field2)

This also does not work as the script has read and is attempting to process field 2, whist the accounting program is still trying to work out what it should do with field 1.

I can use the sleep command but this is not very elegant or practical for the following reasons:

1) Some machines are faster then others, so that while the script may work on 1 machine it will not work on another.

2) Some times the program execution could be delayed, eg busy network, so whist the script will work most of the time it occassionally crashes.

3) This solution means that I need to slow the script down to the slowest machine in the network.

Is there anyway I can dynamically and automatically control when a particlar peice of script will be executed

Thanks

Jeff Lasnitzki

Share this post


Link to post
Share on other sites



Hi,

how do you manually know, when the program is ready?

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

you can always put a 5+ second sleep in the script so it pauses after each movement

Edited by Paulie

Share this post


Link to post
Share on other sites

Mega Asked

"how do you manually know, when the program is ready?"

The program only moves to the next field when ready. It may for example validate that a valid product code has been entered, that the item is not blocked and there is stock on hand befor moving to the quantity field.

An operator would see the cursor has moved to the quantity field and enter a value

Jeff Las

Share this post


Link to post
Share on other sites

Pualie wrote

"you can always put a 5+ second sleep in the script so it pauses after each movement"

Yes this is the only way I can get the script to work, but it is fraught with danger and is inefficient.

A 5 second delay may work on one machine but not the next. Also the 5 second delay may work 95% of the time but fail because of heavy traffic over the network on a particular day.

The sleep delay will have to be set unneccessay high to avoid failures.

I am looking for a better solution

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hi,

have you tried to use the controlcommand to check whether the ... is enabled?

Maybe this works?

It is hard to guess when you cannot test or try it yourself. Sorry!

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Can't you use WinWaitActive with the optional field of text?

The title is always the same, but maybe the text in the box changes?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0