I thought in a script that works in this way: I select a frame text (802004020) e.g. and the script places all images starting with 802004020 in a specific folder. Is it possible?
It sure is possible. If I understand correctly, you don't even have to select a text first — this would be the InDesign file name, right? Then you can use
var imageRootName = app.activeDocument.fullName.name.match(/^.+(?=.indd$)/i);
Gathering image file names from a specific folder is as easy as this:
var specificFolder = Folder('/c/temp');
var imageList = specificFolder.getFiles(imageRootName+'*');
alert (imageList.join('r'));
Despite its name, the 'getFiles' function can return both files and folders. If there is a chance your file name specification might also match a folder, you can inspect each of the returned File objects like this:
if (imageList[i] instanceof File)
.. yes, safe to place
Is this enough to get you started?