Jump to content
Sign in to follow this  
leuce

WinActivate doesn't activate window

Recommended Posts

leuce

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

Share this post


Link to post
Share on other sites
Xenobiologist

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

Share this post


Link to post
Share on other sites
leuce

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

Share this post


Link to post
Share on other sites
leuce

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.

Share this post


Link to post
Share on other sites
i542

Maybe you can add and text, so it looks as:

WinActivate("program title","program text")

i542


I can do signature me.

Share this post


Link to post
Share on other sites
leuce

Maybe you can add and text, so it looks as...

Thanks for your input, but the Window Spy tells me there is no program text.

Share this post


Link to post
Share on other sites
leuce

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 :-).

Share this post


Link to post
Share on other sites
MHz

If you are minimizing the window, then you may need to use WinGetState() to get the state to resolve if needed and use WinSetState() to restore the window.

Share this post


Link to post
Share on other sites
i542

Maybe to create function WinMinimize?

i542 100000


I can do signature me.

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  

×