Since FileMaker 7, a great job has been done to reduce the script/layout dependency.
Some may remember the times when even Replace field contents required the target field to be on the current layout.
A lot of these were removed, until version 16 in which was introduced Insert into a variable for some script steps.
Still, not all script steps are affected, and there is a good reason for that.
Insert picture or Insert PDF are not. They still require that the field is on the layout, and even active.
Why active, I don't know (but you cannot select a field in the script step, so only the active field can be targeted)
But why you can't insert a picture or a PDF is clearer:
The result of the insert step will be different if the layout object is optimized for images or interactive content (tab 4 of inspector)
The problem is that depending on
- the script step used (insert file, insert picture…)
- the layout object formatting
The result will be different.
And… I'm quite sure not everyone is very aware of the differences (this is an understatement)
What I would suggest is a revamped insert file script step with maybe an advanced tab where you could see/control everything FileMaker is currently doing without you to really want it.
- should be prefix insensitive (image:, file:…), all should be supported. [Side note: if Insert picture could also support file: prefix it would save a lot of times where you wonder why you get an error 3 (command unavailable) before you realize that you just switched from insert file to insert picture without updating the path.]
- should be able to define if you want to insert as a picture, an interactive PDF or as an icon.