Dynamic file path when running programs

Hi, I’m doing some post-processing on generated files and it works well with hardcoded file path, but I can’t figure out how to get relative file location of the generated file.

Here’s the example:
I generate file and store it in a folder using relative path.

image

Parameter formula looks as follows:

“Results\File_” & format(now(), ‘yyyy-MM-dd_hh-mm-ss_tt’) &".xlsx"

When running a program with hardcoded file path, it works great:

But when I try to pass parameter as a dynamic path it doesn’t work. How can I get the full path of exported file?

Error: External program failed with exit code -532462766; path=C:\Users\Ruslan\Desktop\xcelParser.exe; args=Result\File_2020-03-15_12-14-28_PM.xlsx; workdir=
Source: action “Run program”, module “Main”, table “Result”

You can use the combinepath() function to obtain an absolute path from a base path and a relative path.

Also, it’s a good idea to specify the working directory. In your case, the working directory would be C:\Users\Ruslan\Desktop. The argument would be xcelParser.exe Result\File_2020-03-15_12-14-28_PM.xlsx.

@dgudkov - but how can we avoid specifying absolute paths in working directory? I want to be able to copy projects to multiple computers of several users and I do not want them to modify paths in each project (We have ~ 10 projects at the moment.)

I’m trying to understand the logic. In your case is a relative path is relative to what - the EasyMorph project, the excelParser utility, or something else?