• 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: Getting label from a record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting label from a record


  • Subject: Re: Getting label from a record
  • From: kai <email@hidden>
  • Date: Wed, 19 Nov 2003 00:13:48 +0000

on Tue, 18 Nov 2003 14:29:10 -0500, Arthur Knapp wrote:

>> Subject: Re: Getting label from a record (part 2)
>> Date: Tue, 18 Nov 2003 17:03:59 +0000
>> From: Nigel Garvey <email@hidden>
>
> Damn you, Nigel Garvey!!! ;-)
>
> We both adopted a similar approach, and yet you ended up producing a solution
> 1,538,292 times more elegant than my own.

He's like that.

> Once again, I doth my hat to you. :)

I doth, too.

>>> Nice one, Kai. :-) The old '{myRecord} as string' trick, huh?

Yeah. The day they break (um, sorry... *fix*) that one, a few of us are
going to be in a bit of trouble...

>> Here's one that doesn't exploit bugs.

Isn't that what they're for? (Or is this a bug rights issue? Are the words
"Down with the exploitation of bugs!" being daubed on thousands of protest
placards as we speak?) ;-)

But you have a point, Nigel. I should really base it on another well-tried
(but hopefully more legitimate) technique:

--------------------

on recordToString(r)
set f to (path to temporary items as string) & "r"
try
close access f
end try
open for access f with write permission
set eof f to 0
write r to f
close access f
read f
end recordToString

--------------------

- although that means I'd have to rewrite my analysis code...

Damn you, Nigel Garvey!!! ;-)

>> try
>> r as real
>> on error msg
>
> It may not be a "bug," but it certainly should count as a "hack." ;-)

I'm with Arthur on that one - even though using tids to extract the text
contained in curly brackets should make it pretty bomb-proof. :-)

The subject does, however, raise an interesting point - which I may have
touched on before. Wouldn't it be preferable if the algorithm that produces
error messages could be harnessed to offer an *official* 'as quoted text'
coercion from a given class to a string?...

+data PICT0000; as quoted text --> "+data PICT0000;"
{Arthur:"Knapp"} as quoted text --> "{Arthur:\"Knapp\"}"
{"Nigel", "Garvey"} as quoted text --> "{\"Nigel\", \"Garvey\"}"

========================

on Tue, 18 Nov 2003 11:53:41 -0800, Christopher Nebel wrote:

> Not to dampen your spirits, since some of you seem to having a lot of fun with
> this (for some definition of "fun")...

[snip]

> ...then consider an alternate data structure -- say, a list where the odd
> values are the labels (as strings) and the even ones are the data.

But where's the fun in <repeat with n from 1 to count l by 2>?

---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: File names in Toast window
  • Next by Date: Re: D'oh-plicate terminology
  • Previous by thread: Re: Getting label from a record
  • Next by thread: Re: Getting label from a record
  • Index(es):
    • Date
    • Thread