Put the parameters parsing in a separated file
Get the export directory path from the document path (the path for the document to open must be specified in parameters)