A TypeText story

Hi Gang,

I have been using TypeText for months with no issue and then it stopped. The command would work just fine if I executed it as a single line of code but wouldn't work if executed it from the script. Hmmm...
Was it a timing issue? Nope.
Was it a single space I found after a function variable? Nope.
Was it the new version of our code that I was testing? Nope.

Everything looked normal using Trace All.

:oops: Doh!
It's always nice to make a back-up of code as it evolves so you can compare working to non-working. A few days ago I had added some code to copy data via the remote clipboard back to Eggplant. I had added TypeText "\cC" to perform a ControlDown-C for a Windows Copy. I believe what was killing me was I didn't come back later to do a TypeText "\C" to do a "ControlUp." As soon as I commented that line out I was back in business again. I had tried the "\C" earlier but apparently I had done it incorrectly so it wouldn't work. It seemed to work without it so I just continued on. Wrong... Details, details.

T!G!I!F!, Bruce

p.s.,
For more info. see Keyboard Commands of the Eggplant Reference manual, p. 137+

Possible Eggplant enhancement: add special key (Alternate, Option, Command, Control) state to the script run window.

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    Thanks for the cautionary tale, Bruce. Yes, it's always important to remember to release those modifier keys when you're done with them. I made a similar mistake in my early days of Eggplant scripting -- you can imagine the odd happenings that occur on the SUT when you start trying to type text while the command key is held down. Or perhaps you don't need to imagine. :lol:

    In the future, you might consider using the keywords instead of the escape sequences in your TypeText commands. A command like this:
    TypeText "\a\o\b\O\A"
    
    (which from the Finder empties the Trash without confirmation) becomes
    TypeText CommandDown, OptionDown, Backspace, OptionUp, CommandUp
    
    Which is of course much longer, but also clearer and perhaps easier to remember.

    One caveat: You can't use the keywords when generating a TypeText command via the TypeText sheet (dialog) on the Remote Screen window -- everything entered via that mechanism becomes a big quoted string. The keywords are something you can use when entering a TypeText command by hand, or when editing an existing command.

    Have a great weekend.

    - Matt
Sign In or Register to comment.