Using the hotkeys to implement window's function ctrl +c

Feature Requests, Comments, Bugs, and Suggestions on the JIntellitype Java API.

Using the hotkeys to implement window's function ctrl +c

Postby Shihtzu88 » Mon Sep 19, 2011 9:03 am

Hi,

Is there anyway for us to bind say ctrl + shift + x of our java application to be the same functionalities like window's ctrl + c ?

It mean that if my java application is open and the user selected a text and press ctrl+shift+x, the java application will copy the selected text to somewhere in the java application
Shihtzu88
 
Posts: 2
Joined: Mon Sep 19, 2011 9:00 am

Re: Using the hotkeys to implement window's function ctrl +c

Postby Melloware » Mon Sep 19, 2011 7:25 pm

Yes, but only if you are copying Java to Java. You would simply map in Jintellitype CTTL+SHIFT+X to then use the ClipBoard functions...

http://download.oracle.com/javase/1,5.0/docs/api/java/awt/datatransfer/Clipboard.html
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11056
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: Using the hotkeys to implement window's function ctrl +c

Postby Shihtzu88 » Tue Sep 20, 2011 12:20 am

Thanks, Melloware.

I know about the clipboard class from java.

Understand that this might not be a question addressed to JIntelliType,

I was wondering if the user mouse-over a text in the browser and pressing ctrl + shift + x would copy the moused-over text to my java app.
Shihtzu88
 
Posts: 2
Joined: Mon Sep 19, 2011 9:00 am

Re: Using the hotkeys to implement window's function ctrl +c

Postby Melloware » Tue Sep 20, 2011 4:52 am

Shihtzu88 wrote:Thanks, Melloware.

I know about the clipboard class from java.

Understand that this might not be a question addressed to JIntelliType,

I was wondering if the user mouse-over a text in the browser and pressing ctrl + shift + x would copy the moused-over text to my java app.


No I don't believe the Java Clipboard class will allow you to copy from other applications.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11056
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: Using the hotkeys to implement window's function ctrl +c

Postby guidomarcel » Fri May 04, 2012 9:14 am

Hi ,
I really appreciate the Jintellitype project. I tried to implement it into my GUI software. My intention was to define a Windows hotkey with Jintellitype. This hotkey should do the following:
    * copy the selected text into the system clipboard by simulating ctrl+C key commmand
    * call a JAva app
    * run a method into the Java app
    * paste the result back in the original Window application where the hotkey was pressed.

The good news is that it works
The bad news is that it only works every 2nd try. It looks like the ctrl+C always needs 2x the hotkey pushed.

Do you have any idea if this behavior is related to windows internal features (Buffer not released,....???) or if this could be related to the way Jintellitype is set-up.

This is how I set-up the onHotKey method:
Code: Select all
public void onHotKey(int aIdentifier) {
     
               System.out.println("WINDOWS+A hotkey pressed");
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                cutNPaste(1);           
        }


This is how I coded the cutNPaste in C++
Code: Select all
   Sleep(1000); //wait
    // Simulating a Ctrl+c keystroke
    keybd_event(VK_CONTROL, 0x9d, 0, 0); // Ctrl Press
    keybd_event(VkKeyScan('C'), 0xAe, 0, 0); // 'c' Press
    //Sleep(100); //wait 
    keybd_event(VkKeyScan('C'), 0xAe, KEYEVENTF_KEYUP, 0); // 'c' Release
    keybd_event(VK_CONTROL, 0x9d, KEYEVENTF_KEYUP, 0); // Ctrl Release
guidomarcel
 
Posts: 1
Joined: Fri May 04, 2012 9:08 am

Re: Using the hotkeys to implement window's function ctrl +c

Postby Melloware » Sat May 05, 2012 7:07 am

Hmmm nothing stands out to me why it only works every other press?
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11056
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA


Return to JIntellitype

Who is online

Users browsing this forum: No registered users and 1 guest

cron