Re: Get characters# ids
Re: Get characters# ids
- Subject: Re: Get characters# ids
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 25 Feb 2010 08:41:50 -0500
If input is a list and the loop is to turn it into one big string,
wouldn't it be more efficient to set TIDs to "" and use "input as
text" instead?
On Thursday, February 25, 2010, Christopher Nebel <email@hidden> wrote:
> On Feb 24, 2010, at 3:51 AM, Shane Stanley wrote:
>
>> On Feb 24, 2010, at 2:36 AM, Thomas Fischer wrote:
>>
>>> I'd like to have a general small AppleScript script(?) to give me the Unicode points for the selected text in the frontmost window (say for the first five characters).
>>>
>>> My first problem is that there seems to be no general method to get the selected text of window 1 of application 1.
>>> So I might try to distinguish between different applications that I want to use.
>>> But then I run into the second problem that I can't use something like
>>>
>>> copy the id of application 1 to myApp
>>>
>>> because AppleScript-Editor will not compile this (as long as it is application 1 I suppose).
>>>
>>> Has anybody an idea?
>>
>
>> The only reliable way will be to copy the selection, and get the id of the text on the clipboard.
>
> Actually, this is a perfect application for the Automator-based Services in Snow Leopard. Your real issue here is getting the selected text, and that's what services can do by definition. Fire up Automator, make a new Service, set it to "Service receives selected <text> in <any application>", and then use a Run AppleScript action that does what you need. My quick and dirty version:
>
> on run {input, parameters}
> set p to ""
> repeat with s in input
> set p to p & s
> end
> set AppleScript's text item delimiters to ", "
> display dialog ((id of p) as text)
> end run
>
> Different presentation forms are left as an exercise for the reader. Alternatively, find an application such as UnicodeChecker that does this sort of thing as a service already.
>
>
> --Chris Nebel
> AppleScript Engineering
>
> _______________________________________________
> 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
>
--
Mark J. Reed <email@hidden>
_______________________________________________
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