Jump to content

WinActivate doesn't activate window


Recommended Posts

G'day everyone

I'm having some problems with a script in which the window doesn't activate. The script begins with the following code:

#include <File.au3>

; Exit script if user doesn't have project open:

$answer = MsgBox (1, "Confirm project is open", "Make sure the project you want to extract an untranslated TM from, is currently open in OmegaT.  If not, click Cancel.")
If $answer = 2 Then Exit

; Wait until OmegaT is active:

WinActivate ("OmegaT", "")
WinWaitActive ("OmegaT", "")

Then obviously the script should wait until a window named "OmegaT" is active before continuing, yes? But it doesn't.

The window in question is a Java program and the full window title is "OmegaT-1.6.0_RC12a :: Test123". Can the fact that it is a Java program have anything to do with it?

I usually start the script when OmegaT is minimised.

I'm using the latest Beta to run the script because later in the script is a single function from the beta.

Any ideas?

Thanks

Samuel

Link to comment
Share on other sites

Hi,

yeah it could be somthing because of Java, but firstly check the WinTitleMatchMode options and Autoit WIndow Tool to get the Title and Text.

Good luck!

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

Link to comment
Share on other sites

I might add that sometimes it activates, but sometimes it don't. Don't know why, can't figure out a pattern.

Well, I got a pattern. If I have previously minimised OmegaT by clicking on the application in the taskbar, then WinActivate doesn't work (well, it works, but it doesn't restore the window... it "activates" it while it remains miminised). If I have previously minimised OmegaT by using the minimise button in the top right corner of the program, then WinActivate works as expected.

I don't want to maximise OmegaT (I want it to be activated (unminimised) to its original size and position on the screen). Any ideas on how to wake it up?

Thanks

Samuel

PS I've tried adding the Opt, and I've checked the window title using the spy tool.

Link to comment
Share on other sites

I don't want to maximise OmegaT (I want it to be activated (unminimised) to its original size and position on the screen). Any ideas on how to wake it up?

I've now had some success with WinSetState to @SW_RESTORE but I'll have to see how long it lasts :-).

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...