Although I can read a phone number from a record, I have been unable to read a phone number from a record, written to a file. In regard to overall context of this script, my goal was to export key value records from Filemaker to be read into an applescript.
Regarding the applescript, itself, reading a phone number from a record succeeds.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set RecordExample to {Phone:"(123) 456-7890"}
--> {Phone:"(123) 456-7890"}
set phonefromRecord1 to RecordExample's Phone
# returns correct value from record
--> "(123) 456-7890"
Reading a phone number from a record in a file fails.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set p2dt to (path to desktop folder)'s POSIX path
set readfile to read (p2dt & "DataRecord.txt")
# fails to return a record
--> "ˇ˛{Phone:\"(415) 408-3365\"}"
tell readfile
set phonefromRecord2 to readfile's Phone
# fails to return a record item
--> Applescript Execution Error: Can’t get Phone of "ˇ˛{Phone:\"(123) 456-7890\"}"
set RecordFromText to text 3 through -1
RecordFromText's Phone
# fails to return a record item
--> Applescript Execution Error: Can’t get Phone of "{Phone:\"(123) 456-7890\"}"
end tell
How do I manipulate a file, so that I can read its record?