Re: Getting the labels of a record
Re: Getting the labels of a record
- Subject: Re: Getting the labels of a record
- From: John Delacour <email@hidden>
- Date: Wed, 16 Apr 2003 21:41:01 +0100
- Mac-eudora-version: 6.0a15
At 10:58 am -0700 16/4/03, Jon Pugh wrote:
You realize the issue, don't you?
Keys which are in the aeut or an aete are stored as the 4 character
constant...
Yep.
So here's what I reckon is the simplest approach to it. Regular
expressions ought to be findable to catch all possibilities. With
contributions from all perly parties, we might work out a solid
routine...
Test by adding sabotaging items to the record and adding regexes at
the place indicated, to deal with them.
set rez_ to {_KEY_1_:{"a", 3.87, name, ""}, _KEY_2_:2,
_KEY_3_:"hello", _KEY_4_:{current date, 3 / 77}, _KEY_5_:{"oooo",
string}, _KEY_6_:"a:b:c"}
-------------
getkeys(rez_)
-------------
on getkeys(r)
try
"" & r
on error s
end try
set fU to "/tmp/rez"
set f to POSIX file fU
open for access f with write permission
set eof f to 0
write s to f
close access f
read f
do shell script "perl -e '
$f = qq~" & fU & "~ ;
open F, $f ;
$_ = <F> ;
s~[^\\{]+\\{(.+)\\}[^\\}]+$~$1~g ; q% remove error stuff %;
q( print the string for reference );
print qq~String is:-$/$/$_$/$/Test items follow. ~ ;
print qq ~Find the pattern:-$/$/~ ;
@ary = split /:/ ;
for (@ary) {
$i++ ;
if ($i eq 1) {
print qq~$_ /* must be OK */~ ;
print $/ ;
} else {
q% ...................................................% ;
q% W R I T E Y O U R R E G E X E S H E R E % ;
q% ....................................................% ;
print ;
print $/ ;
}
}
'"
end getkeys
-- JD
_______________________________________________
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.