Yes, in Archicad 10 you can have a Macro send a value back to the object that called it. I've not used it yet myself, but the syntax for the "CALL" statement is on page 218 of the GDL manual.
CALL macro_name_string [,] PARAMETERS [name1=value1 , ... namen=valuen][[,] RETURNED_PARAMETERS r1, r2, ...]
and END/EXIT
END / EXIT [v1, v2, ..., vn]
I have no idea what the difference is
😉 There are no examples in practice that I can find, or I could help more.
I don't know of any way for a GDL object to pick up the names of objects in a directory.
Tom Waltz