Paul Clapham wrote:Java isn't the right choice of language for it.
Ulf Dittmer wrote:If you want to do this specifically inside a browser, then a browser extension might be the way to do it. For example, in Firefox you can get pretty far using XUL - basically JavaScript using some Firefox-specific APIs. See https://developer.mozilla.org/en/docs/Building_an_Extension and http://kb.mozillazine.org/Getting_started_with_extension_development to get started.
Paul Clapham wrote:Okay... let's try a little more clarification. This program would be a separate program from the browser, but it would modify how the browser works? Or it would just extract text from the browser's display and do something with it?
Or would it be code which runs in the browser? If you're focusing on Java, then that would be an applet.
Paul Clapham wrote:Well, clearly it is possible because you have posted a screenshot from an app which does exactly that. But perhaps you could clarify: do you just want to write a browser which has this feature? Did you perhaps want to write an application which could look into windows of other Windows applications? A clearer description of your goals would be very helpful.
Paul Clapham wrote:I wouldn't expect Ctrl-Alt-A to cause the "select all" to fire, that would be Ctrl-A which would do that. Unless your code is using a KeyListener and fails to notice the difference?
Paul Clapham wrote:Couldn't you choose some other more reasonable keystroke? Like Ctrl-Alt-I or something like that?
Paul Clapham wrote:
Miltos Deligiannis wrote:It means press "Alt" "a" and "i" keys simultaneously. on release, print '\u0101'
I also didn't understand why you wanted to call the getKeyStroke method with more than one char argument, when it looked to me like you should be calling KeyStroke.getKeyStroke('\u0101'). That method doesn't seem to have anything to with the keys pressed.
I don't believe that Java (or in fact most languages) can deal with multiple non-control keys being pressed at once. Have you seen this exact key binding working in other environments?
Paul Clapham wrote:For a start I didn't understand what "alt+a+i" meant. I thought you would explain that when you were explaining your actual problem, but you didn't, so I'm going to have to ask what it means. (I can think of three possible meanings for it.)
Paul Clapham wrote:What do you mean by "handling a combo"? And why do you think you need a Keystroke object to do that?
Paul Clapham wrote:Can we go back a step and find out why you are looking for Keystroke objects?
static KeyStroke getKeyStroke(char keyChar)
Returns a shared instance of a KeyStroke that represents a KEY_TYPED event for the specified character.
static KeyStroke getKeyStroke(Character keyChar, int modifiers)
Returns a shared instance of a KeyStroke, given a Character object and a set of modifiers.
static KeyStroke getKeyStroke(char keyChar, boolean onKeyRelease)
Deprecated. use getKeyStroke(char)
static KeyStroke getKeyStroke(int keyCode, int modifiers)
Returns a shared instance of a KeyStroke, given a numeric key code and a set of modifiers.
static KeyStroke getKeyStroke(int keyCode, int modifiers, boolean onKeyRelease)
Returns a shared instance of a KeyStroke, given a numeric key code and a set of modifiers, specifying whether the key is activated when it is pressed or released.
static KeyStroke getKeyStroke(String s)
Parses a string and returns a KeyStroke.
static KeyStroke getKeyStrokeForEvent(KeyEvent anEvent)
Returns a KeyStroke which represents the stroke which generated a given KeyEvent.
I'm pretty sure Docx4j can open and convert the old formats to the newer 2007 (2010?) formats.
I've seen no indication that docx4j can handle the old binary Office formats. Or did you mean the 2003 XML formats?
Handling legacy binary .doc files
Apache POI's HWPF can read .doc files, and docx4j could use this for basic conversion of .doc to .docx. The problem with this approach is that POI's HWPF code fails on many .doc files.
An effective approach is to use OpenOffice (via jodconverter) to convert the doc to docx, which docx4j can then process. If you need to return a binary .doc, OpenOffice/jodconverter can convert the docx back to .doc.
There is also http://b2xtranslator.sourceforge.net/ . If a pure Java approach were required, this could be converted.
Wim Vanni wrote:I'm pretty sure Docx4j can open and convert the old formats to the newer 2007 (2010?) formats. I haven't used this myself but making a POC for this shouldn't be too hard. If this is succesful you basicly have at that point, XML. Plenty of Java libraries around to handle (and search in) XML, and if needed, adding regexp searching to that shouldn't be difficult either.
You don't have to be a guru. Just learn new ingredients now and then and learn to combine them into extraordinary dishes
Chef Wim
Ulf Dittmer wrote:The XML supported by Office 2003 is very different from the Office 2007 formats.