Buttons do not get the focus when you click them so clicking them does not make them the active object. This is by design or we would be unable to modify text at the cursor's location in a field by clicking a button.
You can do one of two things:
Remove the button formatting and use the OnObjectInsert trigger to perform your script. Then, because you have put the focus in the field, get ( activeFieldName ) will return a value.
Keep the button formatting and pass the object name as a script parameter to the script.
Update. I succeeded getting variables to work not treating field as a button, but leaving it as field and setting script trigget OnObjectEnter. Now it retrieves correct field names, but it doesn't set fields right. BASE::xpicture is set to container field, but when the field is set, it only displays text, i.e. - OBJECTS_BASE::p01 and not picture.
I should note that pictures in p01, p02, p03 are not stored in the file, only references to them. Maybe there's a problem?
How are you setting the field?
Perhaps you used "OBJECTS_BASE::p01" instead of OBJECTS_BASE::p01 as the calculated result part of a set field or set field by name step?
I just used Insert Picture script step instead of set field and it worked :)