Java apps diferentiation at #If WinExist

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

Java apps diferentiation at #If WinExist

26 Mar 2017, 09:22

Hi!

I'm using Java apps which have in class and exe the same parameters.
When I used window spy, I found also wintitle - but this is not stable 'cause monitors process, so found data:

Code: Select all

ahk_class SunAwtFrame
ahk_exe javaw.exe
And apps have stable part of title at beginning (VIC20, C64, C128):

Code: Select all

VIC20 PAL: 1 108 405 / 1 000 000 RPM:0.0  50.36Hz  (19ms)
C64 PAL: 985 248 / 1 000 000 RPM:0.0  50.124Hz  (5ms)
C128 PAL: 985 248 / 1 000 000 RPM:0.0  50.124Hz  (19ms)
They have same script functions, but one needs extra remapping, which has stable title:

Code: Select all

Relaunch64
I have in script condition

Code: Select all

#If !WinActive
so, if is window not active.

I need to let Relaunch64 work with functions which are in condition disabled - I was using condition:

Code: Select all

!WinActive("ahk_exe javaw.exe")
but this disables mapping for all apps written above. I need let Realunch64 let work, but VIC20/C64/C128 disable.

So, I tried to search in help.
I found SetTitleMatchMode and multiple parameters:

SetTitleMatchMode I selected mode 1 - title must begin with %string%

Ok, then I created condition for C128 only to test it and used:

Code: Select all

#If WinExist(C128* ahk_exe javaw.exe)
#If WinExist(C128* "ahk_exe javaw.exe")
#If WinExist(C128 ahk_exe javaw.exe)
#If WinExist(C128 "ahk_exe javaw.exe")
#If WinExist(C128* ahk_class SunAwtFrame)
#If WinExist(C128 ahk_class SunAwtFrame)
#If WinExist(C128 "ahk_class SunAwtFrame")
#If WinExist(C128* "ahk_class SunAwtFrame")
but no one match...

Really don't undestand if has to be used
C128 with asterisk like in DIR command or if has to be class or exe in quotes...

Can anybody explain me where I do mistake?
Thank you for each help.
Miro
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Java apps diferentiation at #If WinExist

26 Mar 2017, 11:35

In ancient AHK-times I was only able to detect the activity of a Java window/element using PixelgetColor.
And I've hated it ... :|

Code: Select all

If WinExist("ahk_class SunAwtFrame")
		SoundBeep
:?:

[JavaAccessBridge.ahk]
[Introduction]
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Re: Java apps diferentiation at #If WinExist

26 Mar 2017, 17:05

Ok, so can you help me with checking WinTitle?
All tests written in previous post failed.

Miro
Elgin
Posts: 124
Joined: 30 Sep 2013, 09:19

Re: Java apps diferentiation at #If WinExist

27 Mar 2017, 03:04

Untested, but any of the below should work:

Code: Select all

#IfWinExist,  C128 ahk_class SunAwtFrame
#IfWinExist,  C128 ahk_exe javaw.exe
#If WinExist("C128 ahk_class SunAwtFrame")
#If WinExist("C128 ahk_exe javaw.exe")
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Re: Java apps diferentiation at #If WinExist

27 Mar 2017, 07:04

Hi Elgin!

Nice to hear about you again, again you helped - working all.
Miro

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Ineedhelplz and 318 guests