Better way to build a record?

Hello.
I need to build a long record with values grabbed by my script.
At this time I have this code:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions

set {theValues, theKeys} to {{}, {}}
# some code
set end of theValues to "Desktop"
set end of theKeys to "itsName"
# some code
set end of theValues to "Bureau"
set end of theKeys to "localizedName"
# and so on
--set anObject to (current application's class "NSDictionary"'s dictionaryWithObjects:theValues forKeys:theKeys)
set anObject to (current application's class "NSDictionary"'s dictionaryWithObjects:theValues forKeys:theKeys)
set near to (anObject as list) --> {{itsName:"Desktop", localizedName:"Bureau"}}
set bingo to item 1 of near --> {itsName:"Desktop", localizedName:"Bureau"}

Is it a way to achieve this task without having to use item 1 of near ?

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 3 septembre 2019 17:05:09

Hi Yvan.

Coerce anObject to record instead of to list:

set anObject to (current application's class "NSDictionary"'s dictionaryWithObjects:theValues forKeys:theKeys)
set bingo to anObject as record --> {itsName:"Desktop", localizedName:"Bureau"}

Thank you Nigel

I really missed what was in front of me.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 3 septembre 2019 22:21:28