Re: Sending a Cmd-V keystroke
Re: Sending a Cmd-V keystroke
- Subject: Re: Sending a Cmd-V keystroke
- From: Jim Graham <email@hidden>
- Date: Mon, 29 Mar 2010 23:26:29 +0100
Hi
Thanks to all who have replied to this. I will try to explain to you why I was looking at this and what I have discovered.
In the education establishment where I was employed, one of the departments had an AppleScript that was used to parse the standard format emails received from students and to process the data. The department wanted to have a program to do the same and to store the data in an SQLite format to be used as an archive and to be viewed via other applications.
I agreed to do this as the requirement could be met using a very simple core data program. As the AppleScript performed the parsing I decide to use it in the program and called the handlers within to get the data into the program.
While I was writing the program the head of the department, who had written the original AppleScript, asked if it would not be simpler just to paste the data from the script into the fields in the program. I told him it was not really simpler as we could easily propagate the fields within the program which was the correct way to do it but when I had finished I would show him how it could be done by pasting. Of course it did not work.
I fiddled about with it for a while and then dumped it. Recently I had a slack period and decided to look again to see what was happening just as a matter of interest.
I had decided it was probably a problem with the queue or dequeueing but could not see what. A few days ago, after corresponding with Jim Correia who also stated het thought it was a dequeueing problem, I wrote a method that emulated the tab key being pressed to use in place of makeFirstResponder. So I had a method emulating the CMD-v (pasteIt) and one for the tab key (tabIt).
The sequence of calls was
put the first text on the pasteboard
pasteIt
tabIt
put the second text on the pasteboard
pasteIt
tabIt
put the third text on the pasteboard
pasteIt
With this set up all three fields get text pasted into them but all of them have the third piece of text that was pasted onto the pasteboard.
It looks like the system puts all three pieces of text on the pasteboard before the first call to paste gets dequeued in the app.
I have satisfied myself about what is happening so have now moved on to pastures new.
Thanks again
Jim Graham
_______________________________________________
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