Suspend script or exclude app?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Suspend script or exclude app?

11 Jul 2018, 18:08

Hi!

I have problem with one application - keyboard is not active even when is excluded from some script definitions by #If WinActive.
But when is suspended script, it works - keyboard is active, to be correct - it is computer emulator.

I need to find a way how to make keyboard work, but don't want really suspend script for its separate functions in script.

So, Q is - how to suspend script when is window found and continue script when is windows closed / no exist?
I can start app by hotkey and after line of start, I placed suspend, so after start script is suspended, but it is possible to start by other ways.

It is not good solution - I need some defined keys and when is window not active want to use also other... simply: need active script - but how to do it?
I don't know if is not battle of AHK and application.

Hee is WindowSpy output

Code: Select all

Kernal64 1.4.5 b5 - 50fps - 100%
ahk_class SunAwtFrame
ahk_exe javaw.exe
and

Code: Select all

Kernal128 1.4.5 b5 - 51fps - 100%
ahk_class SunAwtFrame
ahk_exe javaw.exe
Can anybody help me?
Thank you all.
Miro
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Re: Suspend script or exclude app?

19 Jul 2018, 05:36

No idea?

Adding info: program is written in Java
Q: how to correctly exclude it from main part of remapping in script?

Thank you for all.
Miro
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Suspend script or exclude app?

27 Jul 2018, 21:55

forgotten, perhaps, perhaps not. perhaps unclear? i for one have honestly no idea what to infer from this segment:
... keyboard is not active even when is excluded from some script definitions by #If WinActive.
But when is suspended script, it works - keyboard is active, to be correct - it is computer emulator. ...
do u have any concrete examples of said script?

anyway, regarding the general question of ho to suspend and unsuspend based on the presence of a window:

Code: Select all

SetTimer, CheckSuspend, 10
CheckSuspend:
	if WinExist("ahk_exe notepad.exe")
		Suspend, On
	else
		Suspend, Off	
return
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Re: Suspend script or exclude app?

28 Jul 2018, 19:25

Ok, code looks good.
But have problem with ahk_exe.
In this case it is javaw.exe and it is not only one app using this exe - Java apps working with.
So, I need to use window title - but how to enter only title part?

When I use:

Code: Select all

SetTimer, CheckSuspend, 10
CheckSuspend:
	if WinExist, Kernal128
		Suspend, On
	else
		Suspend, Off	
return
it never reaches Suspend, On or Suspend, Off.

In other applications I have no problem - so please explain me how to add part of window title.

Thank you for your patience.
Miro
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Suspend script or exclude app?

28 Jul 2018, 21:36

you use SetTitleMatchMode RegEx and construct an appropriate regexp to suit your needs

SetTitleMatchMode 1 or unspecified already matches the start of a window title, so it should work already
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Re: Suspend script or exclude app?

29 Jul 2018, 20:53

I used at beginning script:

Code: Select all

; SetTitleMatchMode 1		; "string" at beginning of window title
SetTitleMatchMode 2			; "string" anywhere in window title
; SetTitleMatchMode 3		; exact window title text
SetTitleMatchMode, slow
;SetTitleMatchMode, fast

Suspender:
 SetTimer, CheckSuspend, 10
CheckSuspend:
	if WinExist, Kernal128
		Suspend, On
		
	else if WinExist, Kernal64
		suspend, On
	else
		Suspend, Off	
return
Works not, where I do mistake?

Miro

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], jollyjoe, KenC80, Rohwedder and 295 guests