Any way to map characters to sequences of virtual key codes?

I have a text and I need to make the java.awt.Robot class instance to type it. The text may contain any Unicode characters. Unfortunately the Robot class accepts only virtual key codes which generate different characters depending on the currently used keyboard layout. I was wondering whether there is any way to create a map of how to convert Unicode characters onto combinations of keyboard layout(s) and sequences of KeyEvent virtual key codes?
I was originally hoping to find access to the method which interprets sequences of virtual keys (represented by KeyEvent instances of type KEY_PRESSED and KEY_RELEASED) and generates a KEY_TYPED key event (which already contains the resulting character). I however failed to find the code responsible for this functionality and I'm afraid this is done by the underlying operating system. Can anyone give me a hint on where to search?
The only workable solution I've found so far is to fire sequences of KEY_PRESS and KEY_RELEASED events and their combinations with the Shift key, listen for eventual KEY_TYPED events and save the mapping between the original press/release sequence and the resulting character if such an event is received. This can be repeated for a set of keyboard layouts switched through InputContext.selectInputMethod().
This solution is however an ugly, inefficient and time consuming hack which may or may not find mapping for a particular character. It also requires a GUI displayed so that one can receive key events, and I also need to find a solution which would run without GUI just from CLI.
Does anyone have an idea on how to implement this more efficiently?

I suspect that you are trying to solve the wrong problem. I don't see any reason for converting characters to virtual keys because:
* this is dependent of current keyboard layout
* many characters will not map at all
If you want to use shortcuts use the virtual key codes instead. I wrote few articles regarding keyboard usage in an international context - check http://blog.i18n.ro/category/readiness/input/

Similar Messages

  • Any way to map fn+i to up arrow ?

    I want to move the cursor without lifting my hands from the standard position. so I want fn-i to be assigned to <up> and similarly for fn-j, fn-,, fn-l. Is there a way to do this?
    Thank you,
    Ittay

    I suspect that you are trying to solve the wrong problem. I don't see any reason for converting characters to virtual keys because:
    * this is dependent of current keyboard layout
    * many characters will not map at all
    If you want to use shortcuts use the virtual key codes instead. I wrote few articles regarding keyboard usage in an international context - check http://blog.i18n.ro/category/readiness/input/

  • Is there any way to click the System Message Box button  through code?

    Hi,
    Is there any way to click the System Message Box button through code?
    Is there any way to restrict the System Message Box ?
    The requirement is, i need to open the MRP Wizard form in MRP.it s run automatically.after completion of the wizard is there finish button.after clicking of the finish button, there have a system message. i want to click on "Yes" button through coding.
    when system message box open.my code is stopped.if i press yes code is running.   
    Thanks in advance.

    Thanks for replay
    bellow given the code
    i am using, when i call the finishMrp function its going to take the itemId from XML and click to the finish button.
    There have a system message .when system message fair my debugging stopped. Please give me any idea.
    Public Function Execuate() As Boolean
    Dim strSQL As String
      Dim objRS As SAPbobsCOM.Recordset
        Dim intLoop As Integer
        Dim objForm As SAPbouiCOM.Form
        objForm = objAddOnCentral.objApplication.Forms.ActiveForm
        objRS = objAddOnCentral.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
        strSQL = "SELECT U_MRPCode From [@ACSYMRPLIST]"
        objRS.DoQuery(strSQL)
        If objRS.EoF Then
        Throw New Exception("No MRP Scenario Scheudled")
        Return False
        End If
    For intLoop = 1 To objRS.RecordCount
                objForm.Freeze(True)
                If intLoop = 1 Then
                initializeMRPRun()
                System.Windows.Forms.Application.DoEvents()
                Else
                reinitialize()
                System.Windows.Forms.Application.DoEvents()
                End If
                MRPRun(objRS.Fields.Item("U_MRPCode").Value)
                System.Windows.Forms.Application.DoEvents()
                objForm.Freeze(False)
                objRS.MoveNext()
            Nex
            finishMRPRun()
            Return True
        End Function
       Private Sub finishMRPRun()
            Dim strResource As String
            Dim objXML As New XmlDocument
            Dim objXMLNode As XmlNode
            Dim objXMLNodeList As XmlNodeList
            strResource = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name & "." & "AutoStart.xml"
            objXML.Load(System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(strResource))
            objXMLNodeList = objXML.SelectNodes("/AutoMRPScript/FinishMRP/Instruction")
            For Each objXMLNode In objXMLNodeList 'objXML.ChildNodes.Item(1).ChildNodes
                Select Case objXMLNode.Attributes("OPType").Value
                    Case "2"
                        systemMessageactiveFormButton(objXMLNode)
                End Select
            Next
        End Sub
    Private Sub systemMessageactiveFormButton(ByVal Instruction As XmlNode)
            Dim objForm As SAPbouiCOM.Form
            objForm = objAddOnCentral.objApplication.Forms.ActiveForm
            objForm.Items.Item(Instruction.Attributes("ItemID").Value).Click()
        End Sub
    Edited by: Badulla Sk on Dec 31, 2009 11:24 AM
    Edited by: Badulla Sk on Dec 31, 2009 11:25 AM

  • Is there any way to map tables in rutime dynamically?

    Hi
    Thank you for reading my post
    My question is mostly technical and i want to know whether with EJB 3.0 (JPA) can do this or not.
    we have an application which we are going to port it to EJB 3.0 from plain JDBC.
    In our application, we have tables which are created after we complete the code,
    Tables are created in customer environment based on thier requirement. we store all details about tables in our metadata system. this details contain table structure and business roles for that tables
    So, We have some tables which we know all of its details but we do not have access to application to recompile it or do mapping procedure again.
    And we need to store records into those tables and also perform EJB Query on them.
    What i want to know is:
    -Is there any way that we could map them dynamically in runtime?
    -How we can query them if we can not map them programically?
    -What will be the query result? it is a collection? if it is a collection, then what are collection elements?
    Thanks

    Thank you for reply.
    We have some tables that are added to our system after we developed the core application.
    Now we need to access those tables using EJB 3.0 .
    We can not predict what kind of tables will be added, when customer add those table they also provide vast amount of metadata that our application need.
    before we think about moving to EJB 3.0, we used JDBC to handle CRUD on those new tables based on metadata that customer file into our core application.
    Now that we thought to move to EJB 3.0, we do not know how to handle those new tables that cutomer define.
    We can not predict what kind of table they will create, so we should find some way to :
    Create all required EJB 3.0 artifacts from
    -A database Table
    -and business metadata that customer file into our core application.
    when we had JDBC, we could create dynamic SQL statement using table name and those meta data. but now with EJB 3.0 we can not find a way to do this because EJB 3.0 need some java class to be present before we could map anything.
    Thanks

  • Is there any way to grade a raw sequence on a framebyframe basis?

    Ive shot some  timelapse that goes day into night, and the only way to have it expose  properly was to use the camera's auto settings which introduced some  sporadic changes in exposure, basically just a few odd frames here and  there. I've tried using colorista to correct it but it doesnt seem to  have the same latitude as the camera raw program in after effects, but  the raw program is limited to correcting an entire sequence and it can  only show the first frame so i cant get to the frames that need  correcting, or compare them to the correct ones if i just imported the  incorrect frames and laid them down on the timeline. So is there any way  to do this in after effects, or any plugins or programs that can do  this?

    http://www.gbtimelapse.com/
    Especially read the theoretical blurb. Once you understand it, you should be able to draw the correct conclusions and construct your adjustments, even if you cannot manipulate camera RAW directly from within AE. In fact you may already solve part of the problem by batching it in Photoshop/ Bridge and working with automatic develop settings...
    Mylenium

  • Is there any way to retrive the data from my USB Key

    Hello,
    I have a usb key I have been using on a Win 7 desktop computer and a Mac Book Air to put in Data on a spread sheet.
    I interchange to put in the data between the computer and my MBA without any problem.
    I am today not able to open the usb memory key in either-Computer or the MAC Book Air.
    Does that mean I have a coruppted USB memory key and the data lost for ever?
    I have just put the USB memory key in my computer and it says File System CDFS.
    I put it in MAC Book Air and it would not open either!!
    Is there any way to access my data. I have no back up...

    If the USB drive won't mount on either computer, it's probable that the drive has failed, in which case it's unlikely that you can recover any data from it. You can do a web search for something like "flash drive file recovery" and you'll find a number of utilities that purport to do file recovery, but all the utilities I'm familiar with require that the drive at least be mountable. There may be services that could attempt recovery, but they tend to be expensive.
    The moral of the story is: never have only a single copy of a critical document, and if you must, never, never have your single copy only on a flash drive (or floppy, for those "old timers" who still use floppies).
    Regards.

  • Is there any way to disable the use of the "Delete" key to delete an email message?

    It's very frustrating when I hit the delete key and iCloud automatically erases the selected email message.  I receive some HTML formatted emails that include a text box that I can utilize to directly reply to something.  If I don't make any mistakes at all, I can utilize this box and post a reply.  But if I mess up and need to delete text, instead of deleting text iCloud deletes the email message.  Is there any way to disable this?
    Thanks for your help.

    I don't believe it's possible to disable the delete key, but could be wrong. However, if you delete an email in error, you can restore it by pressing cmd + Z to undo the deletion.

  • Any Way to down load of SAP Employee Lookup  project code

    HI,
    We could download the SAP Employee Lookup from itunes on iOS and test tehre itself of mobile.
    is there any way we can get the packaged code for download , so that we can deploy on the SUP server and test the same.
    or do some customization to the exisitng code
    Regards
    Chandra

    hi,
    I know this may not answer the question but i think you have gone one step ahead of me, and I wish for you to assist me with the instalation of SAP Employee Lookup. 
    While following the configuraiton guide, I needed to add a service.  Whilst adding the service, it asked me for a package which is not stated on the configuration guide.  Which package do i need to create? Do I need to create a new package by running transaction code se80 and if so, what will be within the package?
    Cheers

  • Any way to map the remotes volume buttons to iTunes' volume slider?

    The reason I ask is I feed a USB audio device (DAC) and the volume buttons on the remote controls the volume to the iMac's internal speakers. I've got all audio outputs set to the USB device. I'd like the volume buttons to control the volume level to this USB device. Is this possible?
    Thanks.

    Bump!
    I think that as an external audio source, the Mac's volume controls (and hence the remote) are disabled. I'm using a digital cable from the Macs 'headphone' port to an external amp and I also cannot use the remote to change the volume. However, using a normal cable works...
    Check by looking at the Output tab of the Sound section of System Preferences and see if the volume options are disabled.
    If they are, then sorry, but I don't know of a fix.

  • Is there any way to set a mail rule using an applescript code?

    I just wanted to know if there is a way to set a rule using a applescript, so that I can send it to a friend.

    You will need to use OLE on the client, which would further require the use of WebUtil. Here (below) are a couple of MS examples that you would need to convert to pl/sql. There are a variety of Oracle notes which discuss reading and writing to MS Word and Excel. These can likely be used as a starting place to talk to Outlook. There is a WebUtil demo which includes an example of how to write to MS Word. It can be found on the WebUtil home page:
    http://www.oracle.com/technetwork/developer-tools/forms/webutil-090641.html
    <li> http://support.microsoft.com/kb/160502
    <li> http://support.microsoft.com/kb/170262

  • Any way to stop a PO match when GL account code is disabled?

    When we match to a PO, we are finding that sometimes the GL accounts are disabled. Oracle allows the match to proceed. I've been trying to find a setting that would prevent that up front or at least throw a warning if the account string is disabled, but haven't found anything. Does anyone know if this is possible?

    This could be a known issue in PO -
    Review note
    R12: Disabled Accrual Account Does Not Prevent PO From Approving And Reserving (Doc ID 1467705.1)+_
    <Admin edit - deleted MOS Doc>

  • Is there any way to stop my I phone 4 telephone key pad disappearing during a phone call - you know you listen to the options and when you come to press the number the key pad is missing.

    Every time I make a call involving chosing options I loose my keypad so I cannot enter the numbers quickly enough...so they keep telling me again what to do -its so frustrating. Have i set somrthing up for a time delay  ?

    This happens to me as well. The keypad does not stay on until the end of the call, it goes out as soon as you bring your hand to it.  Sometimes I can type a key, mostly not.  I can never type a 4 during a call.  Given the prevelance of phone trees when calling a business this makes the phone as useless as an old rotary pulse phone.  I hope this issue gets some attention, or my next phone will not be an iPhone.

  • Is there any way I can download Photoshop CS4?

    I bought Photoshop CS4 in 2010 and I downloaded it on my old desktop. Now I've gotten a new laptop and I can't find the disk to download it. I still have my code number for it though. Is there any way to download it online and then enter the code? Or perhaps transfer the application from one computer to the other- is that even possible?

    Direct Download All Official Adobe CS4 and CS3 Free Trials
      http://prodesigntools.com/download-adobe-cs4-and-cs3-free-trials-here.html
    Follow instructions exactly.

  • 1st-gen Mac Pro does not boot in any way, not even in safe mode

    I have a 1st-generation Mac Pro with the graphics card upgraded to NVIDIA GeForce 8800 GT; running 10.7.2. I have had no problems with the machine since I bought it in May 2007... until now. Specifically, the machine suddenly became non-responsive, froze (I do not remember this ever happening before), so I had to power it down and restart. After that, the machine does not boot in any way: does not start up with the Option key; no FireWire target mode; does not start up even in the safe mode. All I get when I power the machine up is the folllowing endless loop: (1) the display unit (30" Apple Cinema Display) waking up from sleep (white light going off) and (2) a flicker of white on the display while the optical drive sounds like checking for any inserted media... then again the display going to sleep for a few seconds and steps (1) and (2).
    I could really use help here. Thank you in advance.

    Linc:
    I am also sure it is a hardware fault. I have tried to run the Apple Hardware Test from the orginal system disc: I opened the optical drive tray with a paper clip, inserted the disc and powered up the machine. However the machine only spinned up the disc, turned the display to standby, spinned up and standby, etc.
    What kind of hardware fault could it be?
    (1) the display unit (30" Apple CInema Display) -- I presume unlikely, since the computer should boot even with a defunct display unit or no display unit at all, for that matter;
    (2) the graphics card
    or
    (3) the logic board?

  • HT1212 i have lost my ipod touch is there any way to get it back

    i have lost my ipod touch is there any way to get it back. i had given pass code for my ipod touch

    If you had turned on the find my iPod, and it is on and it is in range of an open wi-fi network, then you may be able to get an approximate street address.
    Otherwise, you would have to look for it as you would anything else that you lose.

Maybe you are looking for

  • [SOLVED] Samba Issue (Arch+Win8 workgroup)

    Hi everyone. It`s been like 3 months that I am trying to add my archlinux VM to my windows network. I have even used arch as my main box but i changed cuz I couldnt share anything. I just created a workgroup in my windows 8 box and it gave me a passw

  • ITunes won't open - wordless error message

    When I try to open itunes, I get a wordless error message that only shows a red octagon behind the itunes application symbol. The only option is to click 'OK'. Any ideas what this is and how to deal with it? I haven't used itunes in a few weeks, so I

  • Can't open a New (additional) tab today! What'up with that?

    In this latest version, the '+' at the end on the line no longer opens a new tab. Nothing happens except the display that says it will open a new tab. I'm on version 30 Beta and that says that I am up to date. I thought that I saw a 'flash' that vers

  • We are losing memory from the hard drive, how can we resolve this issue?

    We are currently have a memory leakage from our hard drive.  We have an Apple imac running snow leopard.   The memory appears to shrink as we use our computer..  This is a conundrum for us, any advice on how to resolve this issue would be appreciated

  • Blank DVD will not be recognized

    Huhu, i have troubles with burning DVD's (i guess also with CD's, but haven't tried yet, no blank CD @ /home ) I'm using graveman (also tried brasero), it found my CD/DVD drive and also makes copies from CD's/DVD's But when i start burning an .iso fi