Send a keystroke to OS X programmatically - objective-c

How would you simulate the keystroke รถ on Mac OS X programmatically?
This isn't just a randomly chosen character, I know you can simulate all ASCII characters as well as some special ones like Esc, Backspace, etc using either an embedded Applescript or CGEventCreateKeyboardEvent. But what about all those keys for which a CGKeyCode isn't defined? There must be a way!

You need to use CGEventSetFlags to set the option modifier of a 'u' key stroke followed by an up key event and then followed by an 'o' key stroke.
https://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html
If you need more info ask and I will create some code example

Related

type lowercase letters after using CGEventSetFlags

I am trying to do some uppercase key strokes, followed by lowercase with Cocoa. Example: AaAaaA
For uppercase stroke I use CGEventSetFlags(key, CGEventFlags.MaskShift)
But then, I want to press the same letter, but this time in lowercase. All my KeyboardEvents are in uppercase. How do I shit to lowercase after using uppercase?
Found this question CGEventPost - possible bug when simulating keyboard events?. My problem is basically the same, but it requires Swift solution. Bitwise flags are beyond my knowledge.

komodo edit cursor 'between' not 'on'?

I'm using Komodo edit 8.5 on windows 8 and I'm finding it impossible to use. let me illustrate why using the 'pipe' symbol (|) for the cursor.
If I am typing on version an earlier version it would type like any app would ie: ms word or txt pad will let me type between characters as:
if(|) ... and I begin to type an x if(x|)
where as on version 8:
if(x|
the cursor destroys characters in front of it.
I normally write encapsulating brackets then press left to enter into them to begin to give my condistion, this is not helpfull. how do I get this to behave?
also the cursor is an underscore in version 8 wtf's with that!?
It isn't a problem with Komodo Edit. You have switched your cursor to "insert" mode. Look on your keyboard for a key labeled "Ins" or "Insert" (for me it is on the number pad, right next to the right arrow). Hitting this key toggles the mode of the cursor.

Is there a flag that tells Zebra printers to include the check digit in the textual representation of a barcode?

I am sending CPCL commands from a handheld device to a Zebra QL220 printer to print barcode labels. It seems that when the barcode prints, the barcode value is correct (it incorporates/appends the check digit to the machine-readable swath of vertical black (and/or white) stripes), but the check digit is not incorporated/appended to the Text representation (below the barcode).
IOW, the barcode may represent "123456789014" but the text value is "12345678901" (it's lacking the check digit).
Is there an easy way to "turn this on," such as via one of the flags sent to the printer via CPCL, or will I have to manually manipulate the Text value to display the check digit appended to the barcode?
Looking through the CPCL manual (page 5.17: https://support.zebra.com/cpws/docs/comtec/PROMAN-CPCL_RevY.pdf ) and the ZPL manual (https://support.zebra.com/cpws/docs/zpl/zpl_manual.pdf), there appears to be no documented command flag that will cause a printer to print the checksum in the barcode interpretation line. I think you will have to include it yourself.

Finding the ascii value for shift-in shift-out in sql?

I've some records which are really messed up.
My team lead told me to find out the position of characters with ascii value 14 and 15.
I've a query
SELECT CHARINDEX(CHAR(14),X_CUSTOMER_COMMENTS)
FROM vp_service_requests;
SELECT CHARINDEX(CHAR(15),X_CUSTOMER_COMMENTS)
FROM vp_service_requests;
which returns 0 because i wasn't able to find char with 14 and 15 ascii value after google
search i found 14 and 15 ascii value are for shift in and shift out
how this represents on keyboard so i can try for it with CHAR(14) function.
As a holdover from the old DOS days, Windows still allows you to enter certain old ASCII keys from the keyboard by pressing and holding the ALT key, followed by the three-digit code you wish to enter (from the 10-key pad, not the numeric row atop the keyboard), eg for 14, type ALT-014.
However, some of the lower-level codes are inherited from old terminal functions, eg ASCII 7 is a bell, 8 is a backspace, eg, and rather that typing a character, they cause the cursor to behave a certain way or induce an application to respond in a defined manner. You can embed a CHAR(XX) value for testing simply by concatenating the value into a string and INSERTing it into your test table.
It should be Ctrl-N and Ctrl-O although I doubt this will help.
Try loading the records into a good editor and look at them in HEX. Weird characters should stick out like a sore thumb

Where can I find numeric keycodes to use with keyPress command in Selenium?

At http://release.seleniumhq.org/selenium-core/1.0.1/reference.html there's description of keySequence parameter to keyPress command:
Either be a string("\" followed by the numeric keycode of the key to
be pressed, normally the ASCII value of that key), or a single
character. For example: "w", "\119".
Nevertheless there's no information on where to look for numeric keycodes to use...
http://aspdotnetfaq.com/Faq/What-is-the-list-of-KeyCodes-for-JavaScript-KeyDown-KeyPress-and-KeyUp-events.aspx
This works for me
What you need are the ascii codes of the number characters, as an example, see the following page:
http://www.asciitable.com/
The numbers go from \48 (0) to \57 (9).
The modules have objects/variables for the common keys, e.g.:
Ruby: http://www.google.com/codesearch#2tHw6m3DZzo/trunk/rb/lib/selenium/webdriver/common/keys.rb
Python: http://www.google.com/codesearch#2tHw6m3DZzo/trunk/py/selenium/webdriver/common/keys.py
Java: http://www.google.com/codesearch#2tHw6m3DZzo/trunk/java/client/src/org/openqa/selenium/Keys.java
I believe these mappings include most of the special keys you're looking for?