The FileOpenDialog () changes the workdir to the directory of the selected file, so do a FileChangeDir(@ScriptDir) after the selection is done. Jos