Confirming all segment in a file one by one?

Hello all,

I was hoping some of you could help me with a script I've been working on.

To make a long story somewhat shorter:
In order to train an Adaptive MT engine as quickly as possible, I’m looking to create a (looped) script that simply confirms a segment, moves to the next, confirms that segment etc.

Issue I’ve encountered:
One of the issues I keep running into with any script that loops "send, {Enter}" or similar commands is that without a (very) long sleep time, Studio loading times will cause problems. Studio will take different times to load for each segment, and the script happily keeps sending the Enter, based on what you’ve specified. This creates a vicious circle where there’s a long load, during which multiple/too many commands are sent, which increases the processing time, etc., etc., until the machine has so many Enters to process it can’t keep up any more. With large files and long segments it can get so bad that my machine freezes up entirely.

Of course a very long sleep time more or less circumvents the issue, but that obvious takes much longer, and I'm certain there's a faster way of doing things.

My unsuccessful attempt:
What follows is one of the scripts I came up with so far. It looks for the state of the mouse cursor and should pause when it’s the little loading circle. Unfortunately, the cursor state didn’t end up being as reliable as I’d hoped in determining whether Studio is loading.

#IfWinActive ahk_exe SDLTradosStudio.exe
^+t::
                loop
{
                if (BreakLoop = 1)
                               break
                send, {Enter}
                sleep 400
;wait until loaded
                while A_Cursor = "AppStarting",
                break
                sleep 500
}
MsgBox Please reload script to try again.

Esc::
                BreakLoop = 1

Return

Solution I’m looking for:
Ideally, what I’m looking for is a script that only sends one confirmation per segment, in order to avoid any loading issues or long sleep times entirely. In order to do that I need some way to determine that the cursor has moved to a new/different segment. Which is what I want to ask for your help for.
And if that's not possible, I think I'd need an effective way to determine when loading is complete.

I should also note that I haven’t yet figured out a way to make the loop stop automatically when the last segment is reached, but that’s less pressing. Should there be a way to identify a new/different segment, perhaps that issue even becomes irrelevant.

Any input you have is very much appreciated!

Thanks,
Rick

Parents Reply Children
No Data