AutoHotkey Community

It is currently May 27th, 2012, 4:22 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: February 24th, 2010, 6:52 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 24th, 2010, 7:33 am 
Offline

Joined: May 12th, 2005, 8:20 am
Posts: 331
Location: Münster, Germany
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 24th, 2010, 4:41 pm 
Offline

Joined: February 24th, 2010, 4:33 pm
Posts: 1
Location: USA
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Mickers, rbrtryn, Yahoo [Bot] and 67 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group