Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Type text #1536

Merged
merged 3 commits into from Aug 14, 2013
Merged

fix Type text #1536

merged 3 commits into from Aug 14, 2013

Conversation

skurfer
Copy link
Member

@skurfer skurfer commented Jul 17, 2013

Sounds like I actually did something, but @pjrobertson did all the work. I just changed the action to refer to his improved code.

As discussed in the user group, a string like this would be completely murdered by the previous AppleScript-based Type Text code:

äöüÄÖÜàéèÀÉÈ

skurfer added 2 commits Jul 17, 2013
Looks like they were fixed by 558fd80 but the new code was never used.
@skurfer
Copy link
Member Author

skurfer commented Jul 17, 2013

Hold the phone. It seems to cut off the text around 20 characters. So much for an easy fix. 😕

@pjrobertson
Copy link
Member

pjrobertson commented Aug 10, 2013

Very strange. Seems that the CGEventKeyboardSetUnicodeString() fnc can't print too many characters. It eats them up and gets jumbled. Try this:

- (void)typeString:(NSString *)string {
    UniChar buffer;
    CGEventRef keyEvent = CGEventCreateKeyboardEvent(NULL, 0, true);
    CFRelease(keyEvent);
    for (NSUInteger i = 0; i < [string length]; i++) {
        buffer = [string characterAtIndex:i];
        keyEvent = CGEventCreateKeyboardEvent(NULL, 1, true);
        CGEventKeyboardSetUnicodeString(keyEvent, 1, &buffer);
        CGEventPost(kCGHIDEventTap, keyEvent);
        CFRelease(keyEvent);
    }
}```

Not as efficient, but it works. Maybe report a bug to Apple (...what good would that do?)

Seems to be in CGEventKeyboardSetUnicodeString()
@skurfer
Copy link
Member Author

skurfer commented Aug 13, 2013

Yeah, that seems to work. How efficient does it really need to be when it’s “typing” out text anyway? 😃

@pjrobertson
Copy link
Member

pjrobertson commented Aug 14, 2013

hehe, yeah. Surely it should be more efficient that you or I would be at typing, otherwise we'd just out whatever text we have ourselves and dump QS right? ;-)

pjrobertson added a commit that referenced this issue Aug 14, 2013
@pjrobertson pjrobertson merged commit 83010e4 into quicksilver:master Aug 14, 2013
@skurfer skurfer deleted the typeText branch Aug 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants