Use Export Field Contents to open the file in the container field. You can click the field to select it and then select this option from the Edit menu or you can use it in a script so that clicking a button opens the file.
But then I have to save this "new" file somewhere...
Is this the only way?
It's pretty much the only way if you are not using inserted files inserted with the Store a Reference option.
With some files and the container field "optimized for interactive use" you can view the contents of the file--such as a PDF file directly in the container field.
But with Export Field contents, the location you specify for the exported file can be the temporary items folder on your computer and then you will not need to delete these files at a later point as they will not persist in the temporary folder.
You may find this thread and the "exploration" file that you can download from it helpful: Exploring the use of a $Path Variable in Scripts
I tried the export solution and it works pretty well, but...
In my script, I use a variable to give the exported file a new name and path to save it in a temp folder.
The problem is :
1- How can I name it the same name as the original file? Can I do this?
2- Because the way I can make it work, it renames it but then forgets the extension, hence the type of file... If I inserted a PDF, then it will open a PDF only if I rename it as a PDF in my script. If I do, then the JPG files won't open. Same with Word files... etc...
Do you see a way around this problem?
Please check out the Exploration file that you can download from the other thread that I suggested. It includes example calculations for extracting the file path and the file name from a container field. The calculation for extracting the filename works regardless of the insertion method and storage options specified.