Results 1 to 9 of 9
  1. #1
    tempomat is offline Member
    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    Default global listener for text replacement

    Hi everybody,

    my goal is a tool in system tray with following functionality: My caret is e. g. in Microsoft Word or Notepad++ or something else and I'm typing "bye" and click the TAB-Button on the keyboard. "bye" then will be removed and replaced with:

    Best regards

    Java Code:
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
      @Override
      public void eventDispatched(AWTEvent event) {
        System.out.println(event);
    
        // some code
    
      }
    }, AWTEvent.KEY_EVENT_MASK);
    The KeyEvents works well in my GUI but not within Word, or Notepad++, or an other software.

    How I can reach my goal?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: global listener for text replacement

    No, you can't write spyware in Java.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    tempomat is offline Member
    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    Default Re: global listener for text replacement

    Spyware?

    I just want my own Text Expander tool like Autotext - Text Expander for Windows - Snippets Organizer

  4. #4
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,098
    Rep Power
    4

    Default Re: global listener for text replacement

    Yeah that's a highly windows specific program. Java does not do Windows specific things, it is designed and intended to be used on multiple operating systems and thus to be as OS-independent as possible. That makes it not the right tool for this job, you need to use something that is far more native to Windows. In other words: .NET.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    tempomat is offline Member
    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    Default Re: global listener for text replacement

    Damn, i like Java.

    Maybe Java and JNI a solution? Or an other workaround?

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: global listener for text replacement

    Quote Originally Posted by tempomat View Post
    Spyware?
    Any program that intercepts input meant for another program. Can't be done in Java.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,098
    Rep Power
    4

    Default Re: global listener for text replacement

    Quote Originally Posted by tempomat View Post
    Damn, i like Java.

    Maybe Java and JNI a solution? Or an other workaround?
    Workarounds are not solutions, stop looking for one. JNI... maybe but don't expect any help with that. You'd still need to do a big chunk of the native development anyway, so why bother?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    tempomat is offline Member
    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    Default Re: global listener for text replacement

    Ok, I will try .NET / C++

    Thank you all.

  9. #9
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,098
    Rep Power
    4

    Default Re: global listener for text replacement

    I would try C# rather than C++, its closer to Java so you may like that more.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Keyboard Listener to Mouse Listener
    By cupOJava in forum Advanced Java
    Replies: 0
    Last Post: 04-28-2013, 09:26 PM
  2. Replies: 0
    Last Post: 03-26-2013, 05:56 PM
  3. Replies: 0
    Last Post: 06-19-2012, 01:03 PM
  4. Replies: 2
    Last Post: 12-11-2011, 10:44 PM
  5. String replacement...
    By diskhub in forum New To Java
    Replies: 6
    Last Post: 05-19-2010, 04:20 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •