Re: Use AS operators dinamically
Re: Use AS operators dinamically
- Subject: Re: Use AS operators dinamically
- From: Thomas Fischer <email@hidden>
- Date: Wed, 6 Jan 2010 10:22:29 +0100
Hi,
with due respect, but apart from the awkward quotes Matt's script isn't much shorter than the direct AppleScript I suggested:
set myArray to {myVar, "starts with", "john"}
set myAction to "return (\"" & item 1 of myArray & "\" " & item 2 of myArray & " \"" & item 3 of myArray & "\")"
run script myAction
without the appscript library loaded and the Appscript module included.
Or are there any side effects I overlooked?
Cheers
Thomas
Am 06.01.2010 um 03:53 schrieb Matt Neuburg:
> On Mon, 4 Jan 2010 19:38:59 +0900, Takaaki Naganoya <email@hidden>
> said:
>> This is 10 minutes' work.
>> AppleScript's language specification is very limited. But our imagination is
> unlimited.
>
> Oh, yeah, like you're really persuading me. Now let's try it in a language
> that actually does this kind of thing for a living. Instead of "10 minutes'
> work", it's 5 seconds work:
>
> def apply(target, op, comp)
> target[its.send(op, comp)].get
> end
>
> All done! This meets Hagimeno's original request for a completely dynamic
> dispatch, where we can start with
>
> set myArray to {myVar, "starts with", "john"}
>
> and use myArray to perform the desired operation and comparand on the
> specified target.
_______________________________________________
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