 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ahkc Guest
|
Posted: Wed Feb 24, 2010 5:52 am Post subject: Trouble with #IfWinActive and java applications |
|
|
I use a lot of open source applications that happen to be written in java (freemind, VUE, etc.). I like to write AHK scripts that will give me keyboard shortcuts that work only in those applications, but am having a hard time getting #IfWinActive to recognize them by their titles. For example, the following does not work (I don't think AHK recognizes the freemind window by its title):
| Code: |
SetTitleMatchMode 2
#IfWinActive FreeMind
F1:: ;Node bgcolor prompt
{
SendInput {ALTDOWN}o
Sleep 30
SendInput n{ALTUP}
return
}
#IfWinActive
|
The only way I've found to get it to recognize FreeMind is using
| Code: | | #IfWinActive ahk_class SunAwtFrame | , but this is giving me trouble when I need different shortcuts to do different things in the various applications. When I do something like | Code: | | #IfWinActive FreeMind ahk_class SunAwtFrame | it stops working.
Has anyone else had this problem? If so, do you know of any workarounds? Is this a bug in AHK? Any help would be greatly appreciated; this is driving me crazy. |
|
| Back to top |
|
 |
Klaus
Joined: 12 May 2005 Posts: 325 Location: Münster, Germany
|
Posted: Wed Feb 24, 2010 6:33 am Post subject: |
|
|
Hi, ahkc,
I understand your problem, I stumbled into it some time ago.
To explain it in short:
For Windows (and therefore for AHK) all Java-windows are not the same as native Windows-windows, they are only objects administered by the Java Virtual Machine and AU3_Spy.Exe will only detect an instance of a JRE-class, a SunAwtFrame for instance and no window title can be found with the known AHK-functionalities.
I think, AHK is not the tool to control Java-applications, but you could have a look at SIKULI, it's a java based open source project to control guis without knowing their inner structure. It's works visually with screen shots. Give it a try!
Hope it helps,
Klaus |
|
| Back to top |
|
 |
ahkc
Joined: 24 Feb 2010 Posts: 1 Location: USA
|
Posted: Wed Feb 24, 2010 3:41 pm Post subject: |
|
|
Klaus,
Thank you for the reply and explanation - figured it had something to do with the java. My one question is that when I run Autoit3 Window Spy, it shows me the following as the information for a Freemind window:
>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
New mindmap.mm - FreeMind - MindMap Mode C:\Users\peter\Desktop\mindmap.mm
ahk_class SunAwtFrame
I find it odd that this tool written in AHK can "read" the title from the window, but any code I write cannot accomplish this same task. I'm assuming that the Window Spy uses WinGet; I'll have to do some testing to see if that will help me get around this inconsistency.
In the meantime, I will check out SIKULI. Thanks again. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|