ANN: String to Property Coercion subroutines released
ANN: String to Property Coercion subroutines released
- Subject: ANN: String to Property Coercion subroutines released
- From: Jeff Porten <email@hidden>
- Date: Thu, 2 Jun 2005 01:44:38 -0400
Needed this for another project I'm working on, so I built it and
it's yours for the taking. Readme follows, available at <http://
www.jeffporten.com/software>.
Freeware for noncommercial use, although donations accepted. Contact
me to use in commercial scripts.
addPropToString will create new properties or replace existing ones,
returning a string that looks exactly like an AppleScript property
statement. getPropFromString returns the value of a selected
property, returning an empty string if the property does not exist.
Syntax:
addPropToString at someprop for somevalue into propstring
getPropFromString for someprop from propstring
set newPropString to addPropToString at "newproperty" for "testvalue"
into ""
--> "{newproperty:\"testvalue\"}"
set newPropString to addPropToString at "newproperty2" for "newvalue"
into newPropString
--> "{newproperty:\"testvalue\",newproperty2:\"newvalue\"}"
set newPropString to addPropToString at "newproperty2" for
"replacevalue" into newPropString
--> "{newproperty:\"testvalue\",newproperty2:\"replacevalue\"}"
set gottenProp to getPropFromString for "newproperty" from newPropString
--> "testvalue"
Best,
Jeff
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden