How do you make Robot type out a variable String?

I don't know why I'm having an issue with this. I want the Robot class to type out a string one character at a time as if I were sitting at the keyboard and doing it myself. There will be many, variable strings to type. Here is what I tried to do and it fails miserably:
private String myString = "example";
// Loop for each character in the string
for(int i=0; i<numChars; i++)
     // Get the current character
     myChar = myString.charAt(i);
     // Convert the character to a keycode
     myKC = (int)myChar;
     // Press the key, release the key
     myRobot.keyPress(myKC);
     myRobot.delay(10);
     myRobot.keyRelease(myKC);
}When I run it, I get some unexpected output in the Notepad window I have open. Instead of it spelling out "example", it gives me something entirely different:
e - instead of 'e', it gives me a '5'
x - instead of 'x', it gives me nothing at all
a - instead of 'a', it gives me a '1'
m - instead of 'm', it gives me a '-'
p - instead of 'p', 'F1' is triggered and the Notepad help window pops open
l - instead of 'l', it gives me nothing at all
e - instead of 'e', it gives me another '5'
What am I doing wrong here? This was supposed to be easy...
Edited by: ConQuesimo on Jan 19, 2010 12:06 AM

ConQuesimo wrote:
     // Convert the character to a keycode
     myKC = (int)myChar;
I don't see a keycode conversion here, keycodes for a to z are the same as ASCII, what I do see is an int conversion of what ever character set you have running on your computer. If I take your approach to conversion, then I get different codes on different keyboards/systems also. What I finally ended up doing is making a map for my keys and everything started working fine.
For me, the problem expressed itself when I went from my Windows with MS-Keyboad to my Ubuntu with an earlier style MS-Keyboad. Character values and single character strings come out fine, but when I would try converting char to KeyCode as you have done, the results were not always what was desired. I've not looked into it to see what was actually causing the problem, ti was faster and easier just to make the map.

Similar Messages

  • How do you make this type of grid?

    This is a very very very simple question, I was wondering how you would lay a grid flat back like this:
    http://cbu2029.deviantart.com/art/Cyberpunk-City-61614863
    I have the grid made, with tthe grid tool. I tried shear tool and that doesn't seem to get me there and I tried the free distort tool but that does not make it precise.
    I know there is some way to grab the top two corners and pull them down and in closer but I am drawing a blank on what it is right now, please help if you can.

    Simply apply the group to a perspective grid or create a warp with a simple rectangle as the envelope.
    Mylenium

  • How do you make a loop out a sample without it having any stops?

    I took a part of a song to make it into a sample. I looped it to make it longer for a song. However, there are awkward stops in the song now. How do I take this out?  I already tried trimming the stops out but it just seems that it doesn't work.

    Check this out.
    http://www.adobeforums.com/webx/.3bc12b29
    or just hit repeat on DVD player.

  • In pages how do you make or type a degree symbol?

    We are trying to type up a report for my son and he wants to state a temprature using the numbers and a degree charchter however we do no see how to do this.

    I thought it was odd you asking that question but now that I re-read it, I see I skipped over the actual question (though I'm not 100% certain it was a real question) and answered a statement. In my defense, sometimes people "ask" questions that way.
    I preface my responses with statements like "On the US keyboard", "In the US iTunes store" or whatever  when there is some indication that the person asking is from outside the US and it might affect the answer. That didn't seem to be the case here.
    Option Shift 8 is for the US keyboard.  It might apply to other keyboard layouts as well.

  • How do you make a link out of a jpg?

    Can an image also be a link?  I have seen them be links before but I cannot locate any information as to how to do it and I do not know html.  The jpg is an ad I need to place on facebook for a one day sale in a group.
    Thanks.

    Facebook does not support, html links. You can only provide a URL which will display a jpg of that site.

  • How do you make a song out of your itunes music library?

    I can't remember how to make a ringtone using itunes music library?  What's the easy way to do that?

    http://bit.ly/yo5vWF

  • How do you make imessage work? The icon is there. You can type in the recipient but are not allowed to hit the send button

    How do you make imessage work? We upgraded to verision5. The icon is there. You can type the message but the send button is not available.

    There is some instability in  iMessage.  It is a versatile and confusing app even though there are so few options in its use. 
    I had issues trying to get iMessage work on both my iPads and my iPhone. 
    ON the iPhone, turning off WiFi service and then trying iMessage fixed the problem.
    On the iPad 2, same thing.  Turning off WiFi service fixed it.
    On the iPad 1, I took a suggestion from zoomzoom and changed the WiFi network configuration on the iPad to use 8.8.8.8 as a DNS server and then use iMessage.  That fixed it.   Now I put the DNS back to default and it still works.
    I suspect the iPod Touch will have the same fix as the iPad.
    If you have a WiFi and 3G iPad or iPhone, try turing off WiFi and see if that fixes it. 
    Why?  (beware, some of this is guesswork)
    iMessage can talk SMS to cellphones and smartphones (that are using the cell-network).  It can also talk Apple iMessage format to iPhones and iPads whether they are on cell-network or on WiFi.  If you are talking to an SMS cellphone, iMessage figures that out and blindly sends your message.  If you are talking to a iOS5 device, iMessage figures that out too, checks to see that they are on-line, and then does something different if they are or are not on-line.  If you type in an email address, and not a phone number, I think iMessage attempts to see if the email address is registered with Apple (or iCloud or whatever) and if it is not, it does something to let you know, possibly by making the Send button not light up. 
    In order to register iMessage and an email, you have to let the iOS device see whatever service it is that iMessage uses.  That is where the problem happenes.  zoomzoom suggested manually setting the WiFi DNS to google's 8.8.8.8 IP address, then run IMessage, and that seemed to fix the problem.  Setting the iOS device to use 3G-only (by turning off WiFi) also fixed the problem.  I suspect going down to StarBucks or McDonalds and using their WiFi would also fix the problem.  Once the problem is fixed, it doesn't seem to come back so I can't test these 'fixes'. 
    To change the DNS on your iPad find your WiFi networks configuration, click on the blue arrow, touch DNS, backspace over the number that is shown, type in 8.8.8.8    Then click on the WiFiNetworks button at the top of the screen.  Now go run iMessage.  After that, you can delete the DNS entry again and leave it blank.  Your iPad will fill it in from the WiFi router when it needs it.

  • TS2755 Is there a fix to deleting already deleted address book contact, from messages search? i.e. when you type in say letter c in messages search, all contact with a c, past already deleted and current all appear?  How do you make the old deleted ones a

    Is there a fix to deleting already deleted address book contact, from messages search? i.e. when you type in say letter c in messages search, all contact with a c, past already deleted and current all appear?  How do you make the old deleted ones appear?

    only way is to restore the phone as new.  OR wait until IOS 7 comes out in the fall.

  • How do you make it not so sensitivity. when turned off set down it comes back on or when working out shirt brushes ipod and it changes music

    how do you make it not so sensitivity. when turned off set down it comes back on or when working out shirt brushes ipod and it changes music

    You didn't say which model of iPod Nano that you have, but generally there should be a lock setting, that can be turned on or off, to prevent accidental changes in settings. And, there is also a setting to turn on or off a feature called, "Shake to Shuffle." It allows you to change songs by just shaking the iPod.

  • How do you make a 3d octagon in photoshop cs4 extended?

    How do you make a 3d octagon in photoshop cs4 extended that you can map artwork to? I've been searched online for a solution that doesn't involve using a 3D program but can't find anything. Can't you extrude a shape like in Illustrator, or exporta true 3D shape from Illustrator that will work? I'd use Illustrator but the mapping thing is finicky, and doesn't alow wrapping images around angles. (now someones going to say: "Don't mention any other programs in a PHotoshop forum!" Yeah yeah, there should be a forum then about using different Adobe programs together.) End of rant, any suggestions much appreciated.
    Thanks,
    Mike

    Thanks for your prompt response!
    Suggested Bridge Update
    It turns out that I got a message that this update had already been installed, which led me to more carefully look at the Bridge window and (finally) see that the Output module had a Quality dropdown: Full, 300 ppi, 150 ppi, 96 ppi and 72 ppi.  Thanks!  I decided to compare the CS4/Bridge results to those I got in CS2 with its convenient File/Automate/PDF Presentation/Multi-Page Document routine that I like.
    My project was an 8-page PDF made from scanned pages of handwritten notes into which some fairly small type had been insert using the Photoshop CS2 Type tool.  In Photoshop CS2, I had settled on "medium quality" JPEG compression as giving a "reasonable" file size (about 7 MB) and "very good/excellent" image quality.  I experimented with making the PDF in Bridge, using all five Quality levels.  See table below.  The Bridge "good minus" file was about the same size as the file produced in CS2, which I judged to be "very good/excellent" and slightly better visually than the 300-ppi, 23.5-MB Bridge file.
    Bridge Quality:
    Full
    300 ppi
    150 ppi
    96 ppi
    72 ppi
    File Size:
    25.2 MB
    23.5 MB
    7.6 MB
    3.2 MB
    2.1 MB
    Subjective Quality:
    Very good
    Very good
    Good minus
    Poor
    Useless
    I appreciate that you may not be all that interested in these observations, but it seems to me that Adobe has done us no favors in the multi-page PDF department in going from CS2 to CS4!
    Install the Old Contact Sheet/Picture Package Plug-Ins
    I had already done this some time ago, in order to get in CS4 the File/Automate/Contact Sheet II feature I liked in CS2.  It does not appear to me that this plug-in has anything to do with make multi-page PDF's.  Perhaps I'm missing something.
    Again, thanks for your response!

  • How would you make an effect like this?

    Hi! I'm new to the forums, but hopefully it's ok if I start this new discussion. I'm very new to Photoshop as well (newbie).
    Here is the image: http://sffbookreview.files.wordpress.com/2012/10/life-of-pi-banner.png
    How would you make the image on the right - with the watercolor painting crop effect of the tiger? Also, how would you make the font on the left gradually turn to orange?
    Thanks! Your help is much appreciated.

    Hi there,
    Here's a really quick tutorial on how to add the mask and gradient text over the image of a tiger.
    Masking the Image
    1) Open your image of the tiger. There should be two layers in your layers panel: the image and a white background.
    2) With the tiger layer selected, click on the icon marked below in the layers panel to create a layer mask.
    3) Being sure you have the mask you just created selected, paint with black using the brush tool to mask out the image. In your layers panel, if you look at the mask icon, you will see the areas where you were painting (on the canvas) change to black. Use a variety of brushes to recreate the effect in your example image.
    Creating Text with a Gradient Effect
    1) Use the Type Tool to create your basic text and reposition it on the page with the Move Tool.
    2) In the layers panel, control click on the type layer and select Blending Options.
    3) In the dialog box that opens, check the Gradient Overlay box and click on the "gradient overlay" text to move to the gradient options. Adjust the angle of the gradient, then click on the colored bar to select the colors you want. Click OK on each dialog to close them.
    Final result:
    I hope this helps, and please let me know if you need any more assistance.

  • How do you make superscripts and mathematics in Preview's text annotation?

    When adding text annotations that include scientific notations, how do you make superscripts, e.g. "3.2 × 10^{-23}"?
    Searching Help for 'superscript' turns up nothing, suggesting the command does not exist, as it does under Baseline etc. in iWork. Please tell me this is not the case! If it is, has the situation been improved in the new operating system?
    A related issue: I wish to include other mathematics -- is there a way to include mathematics similar to LaTeX? Might Preview incorporate using latex code in the future, so I can easily type "\exp{-\lambda t}" etc and have the math appear?
    I'm adding text annotations to PDF lecture notes in Preview, basically filling in blanks the instructor has left so students will pay attention in class, and these annotations include superscripts; I wish to format properly.
    Thank you!

    Once you have the circle shape displayed, long press on the border of the circle. Once it is highlighted, drag horizontally or vertically. This should allow you to distort the circle into an ellipse (or the square into a rectangle).
    Hope that helps,
    Frank
    Sketch Engineering

  • HT204053 I have multiple devices used by family members, how do you make sure the kids don't see Moms messages from Dad and visa versa?

    I have multiple devices used by family members, how do you make sure the kids don't see Moms messages from Dad and visa versa?

    Hi Roger:
    Thanks for the reply.  I think I figured out the problem.  Apple has confused (at least in my mind) the different IDs that people can have.  In the iCloud settings, they use the term Apple ID and not iCloud ID.  I guess there really is no such thing as an iCloud ID.  There are Apple IDs with various attributes.  This is not clearly explained or easy to see (how could I look up to see if my Apple ID is associated with iTunes for example?).
    I created, what I thought were iCloud IDs for each family member, but we all use my Apple ID for iTunes.
    One other question - why does the syncing of Notes using iCloud require an @me.com email account.  That makes no sense to me.
    Thanks for your help!
    AO

  • How do you make a MacBook Pro talk to an Epson printer?

    MacBook Pro
    OS X 10.6.8
    (Thinking about getting  another MacBook)
    I had an Epson Artisan printer, got an Epson Workforce WF-3640 new in Jan, hardly used because I cannot make it do what I want it to do. Wireless connection is good.
    With the MacBook Pro, the interface with the Epson printers is not what it used to be on the G4: no ColorSync, no 2-sided, no thick paper, none of those kinds of instructions appear on the generic printer control panel. Which by the way, bears NO resemblance to the Epson manual screenshots, and the instructions in the Epson manual are useless.
    How do you make a MacBook Pro talk to an Epson printer? And by the way, I cannot use the scanner either. I have to set up a document to print, then when the printing progress box appears, click on the scanner icon.
    Also
    Printer has 2 compartments. Top compartment #1 for all types paper.
    Bottom compartment #2 for plain paper only.
    I load glossy photo paper in #1, it prints plain paper from #2 even though I entered instructions on the control panel on the printer.

    If you haven't done so already, try resetting the printing system.
    Reset Printing System

  • How do you make an array of image icons and then call them?

    How do you make an array of image icons and then call them, i have searched all over the internet for making an array of icons, but i have
    found nothing. Below is my attempt at making an array of icons, but i cant seem to make it work. Basically, i want the image to match the value of the roll of the dice (rollVal)
    Any help would be greatly appreciated, some code or link to tuturial, ect.
    /** DiceRoller.java
    * Roll, print, Gui
    import javax.swing.*;
    public class DiceRoller extends JFrame
         private ImageIcon[] image  ;
         public String[] images = { "empty", "dice1.jpg",
                   "dice2.jpg", "dice3.jpg", "dice4.jpg",
                   "dice5.jpg", "dice6.jpg" };
         public Dice die;
         private int rollVal;
         public int rollNum;
         private JLabel j1;
         public DiceRoller(){
              j1= new JLabel("");
           die =new Dice();
           int rollVal;
           rollVal = die.roll();     
           image = new  ImageIcon[images.length];
         for(int i = 0; i < images.length; i++){
          image[i] = new ImageIcon(images);
         if (image!=null){
              j1.setIcon(image[rollVal]);
         System.out.println("Roll = "+die.roll());

    Demo:
    import java.awt.*;
    import java.net.*;
    import javax.swing.*;
    public class IconExample {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    launch();
        static void launch() {
            try {
                Icon[] icons = new Icon[6];
                for(int i=0; i<icons.length; ++i) {
                    String url = "http://www.eureka-puzzle.be/cast/images/dice" + (i + 1) + ".jpg";
                    icons[i] = new ImageIcon(new URL(url));
                display(icons);
            } catch (MalformedURLException e) {
                throw new RuntimeException(e);
        static void display(Icon[] icons) {
            JPanel cp = new JPanel();
            for(Icon icon : icons) {
                cp.add(new JLabel(icon));
            JFrame f = new JFrame();
            f.setContentPane(cp);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

Maybe you are looking for

  • Conversion with Conditional Text in Table

    I'm taking the first steps in converting Unstructured Frame to Structure. One document is pretty clean except for one issue: my structure breaks around conditional text in tables. (The tables have a f3ew issues oftheir own, but the conditional text s

  • USB connection unstable in Windows 8

    When I connect my Z2 to my WIndows 8 laptop through the USB cable the connection is unstable. The laptop recognises the phone and shows it as external harddrive in Windows explorer, but when I open the drive it does not respond. Then after a while it

  • Workorder_update-In_Update is not working

    Greetings, We are using a Badi named workorder_update for maintenace order tracking.Here the problem is ,the methods At_save ,Before_update works coorectly in order.But we are not able to access the method IN_Update.The enhancement is implemented but

  • Can creating new object without object reference cause OutOfMemoryException

    I am getting OutOfMemoryException in my application. After looking at the logs and doing some analysis I think creating a new object and not attaching it to a reference is causing the issue. The simplified code is as below: void valuate(int tradeNum)

  • Change System Form Name

    Hi,    I am trying to chagne the name of the "Sales Quotation" to something else. Pl. note I am totally new to B1 SDK's and .NET also. Any help will be appriciated.    Awaiting replies.