• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: System Events & Key Code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System Events & Key Code


  • Subject: Re: System Events & Key Code
  • From: Christopher Stone <email@hidden>
  • Date: Tue, 15 Sep 2015 20:57:12 -0500

On Sep 15, 2015, at 19:18, Shane Stanley <email@hidden> wrote:
I suspect you'll need to build a conversion table because there's no usable pattern to it -- A = 0, S = 1, Z = 6. And you'll need to use a modifier key for uppercase -- these are codes for keys, not letters.
______________________________________________________________________

Hey Shane,

I was afraid I'd have to do that...

Just remember it is US keyboard-dependent.

That has its problems.

Any reason you're not using keystroke instead?

Because it doesn't work when retyping keystrokes in Russian.  :)

Since this can't be done easily enough on the fly I think the translation table is the way to go,  

I won't need to use key code.

And I can let the user build his own table after I figure out the nuts and bolts.

In essence I have a Keyboard Maestro user who types in both English and Russian.

Frequently he types some text in English that he really wanted to type in Russian, and he wants to rewind and fix that in an automated fashion.

Something like this will probably be quite sufficient once wrapped in a macro:

-------------------------------------------------------------------------------------------
set _english to "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
set _russian to {"ф", "и", "с", "в", "у", "а", "п", "р", "ш", "о", "л", "д", "ь", "т", "щ", "з", "й", "к", "ы", "е", "г", "м", "ц", "ч", "н", "я", "Ф", "И", "С", "В", "У", "А", "П", "Р", "Ш", "О", "Л", "Д", "Ь", "Т", "Щ", "З", "Й", "К", "Ы", "Е", "Г", "М", "Ц", "Ч", "Н", "Я"}

set _text to "ghbdtn"
set _text to characters of _text

considering case
repeat with i in _text
set contents of i to item (offset of (contents of i) in _english) of _russian
end repeat
end considering

return _text as text

--> привет
-------------------------------------------------------------------------------------------

And the end result will be much faster too.

Thanks for the help.

--
Take Care,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: System Events & Key Code
      • From: Shane Stanley <email@hidden>
References: 
 >System Events & Key Code (From: Christopher Stone <email@hidden>)
 >Re: System Events & Key Code (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Icon size / Button in Display Dialog
  • Next by Date: Re: System Events & Key Code
  • Previous by thread: Re: System Events & Key Code
  • Next by thread: Re: System Events & Key Code
  • Index(es):
    • Date
    • Thread