• 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: Problem with NSAppleScript execution
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with NSAppleScript execution


  • Subject: Re: Problem with NSAppleScript execution
  • From: John Joyce <email@hidden>
  • Date: Tue, 13 Sep 2011 09:31:40 -0500

NumberInput_IMKit_Sample
http://developer.apple.com/library/mac/#samplecode/NumberInput_IMKit_Sample/Introduction/Intro.html

It takes a different approach, but an input method allows you to evaluate and modify text as it is entered, generally with the idea of performing "conversions". But the idea is really the same thing.
Though, keep in mind, an input method probably won't make it on to the app store under the current ecosystem.

On Sep 13, 2011, at 9:20 AM, Nava Carmon wrote:

> No, I tried to use something like this for copy for instance:
>
> - (void) performCopySequence
> {
> 	CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
> 	CGEventRef saveCommandDown = CGEventCreateKeyboardEvent(source, (CGKeyCode)8, YES);
> 	CGEventSetFlags(saveCommandDown, kCGEventFlagMaskCommand);
> 	CGEventRef saveCommandUp = CGEventCreateKeyboardEvent(source, (CGKeyCode)8, NO);
>
> 	CGEventPost(kCGAnnotatedSessionEventTap, saveCommandDown);
> 	CGEventPost(kCGAnnotatedSessionEventTap, saveCommandUp);
>
> 	CFRelease(saveCommandUp);
> 	CFRelease(saveCommandDown);
> 	CFRelease(source);
> }
>
> But this doesn't work as expected always for some reason.
> Can you point me to any examples with IMKit?
>
> On Sep 13, 2011, at 5:18 PM, John Joyce wrote:
>
>> Have you looked at building an input method? IMKit
>> On Sep 13, 2011, at 9:03 AM, Nava Carmon wrote:
>>
>>> They want services as an option, not as main workflow.
>>> What about simulating keyboard events? Should it work better than apple script?
>>>
>>> On Sep 13, 2011, at 4:48 PM, Jerry Krinock wrote:
>>>
>>>>
>>>> On 2011 Sep 12, at 22:01, Nava Carmon wrote:
>>>>
>>>>> My application intercepts clicks/key down events and brings the text from the frontmost application to my application on catching a certain key sequence. Then it evaluates it and pastes fixed text back to the application, that was frontmost.
>>>>>
>>>>> I tried using accessibility APIs, but not all applications support it. AppleScript seems to be the universal solution in this case, since it's mostly simulates copy & paste key sequences, but may be there are another technologies, that can be used for this purpose. Are you aware of something more robust?
>>>>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Problem with NSAppleScript execution (From: Nava Carmon <email@hidden>)
 >Re: Problem with NSAppleScript execution (From: Jerry Krinock <email@hidden>)
 >Re: Problem with NSAppleScript execution (From: Nava Carmon <email@hidden>)
 >Re: Problem with NSAppleScript execution (From: Jerry Krinock <email@hidden>)
 >Re: Problem with NSAppleScript execution (From: Nava Carmon <email@hidden>)
 >Re: Problem with NSAppleScript execution (From: John Joyce <email@hidden>)
 >Re: Problem with NSAppleScript execution (From: Nava Carmon <email@hidden>)

  • Prev by Date: Re: Problem with NSAppleScript execution
  • Next by Date: Re: Responder-Chain question.
  • Previous by thread: Re: Problem with NSAppleScript execution
  • Next by thread: iPad store ?
  • Index(es):
    • Date
    • Thread