In my application I want to open some files with the correct default programmes, like .doc file should be open with WORD and .psd files should be opened with Photoshop if it is
Invoke the system command 'open'. Works on Windows and Unix based clients.
Depending on where your script runs, you might not be able to invoke system commands though, for instance in a browser sandbox.