QuPath Script Subcommand Problem


I’m trying to start QuPath on my windows computer through CMD (thats actually no problem, also to open a project through the subcommands), but I m not able to start a script for an project by cmd. (Just to declare: for automatic workflow - 2 scripts: one is creating an project out of images in an folder, the other one is doing the analysis, dection…)

I tried these options:
E:/path/to/qupath/.exe -p E:/path/to/project.qupproj
WORKS: opens qupath, opens the selected project

E:/path/to/qupath/.exe -script E:/path/to/script/.groovy
E:/path/to/qupath/.exe script E:/path/to/script/.groovy
E:/path/to/qupath/.exe -s E:/path/to/script/.groovy


E:/path/to/qupath/.exe -script E:/path/to/script/groovy -p E:/path/to/project.qupproj
E:/path/to/qupath/.exe script E:/path/to/script/groovy -p E:/path/to/project.qupproj
E:/path/to/qupath/.exe -s E:/path/to/script/groovy -p E:/path/to/project.qupproj

doesnt work. Does anybody has n idea how the command has to be?
On top of that: How do i define that the script needs to run (just normal) OR run for project ?

best regards, keep crushing it!

Hi @Vogt_without_i at the risk of getting this wrong (since I haven’t run it myself), I think this should work:

E:/path/to/qupath/.exe script -p E:/path/to/project.qupproj E:/path/to/script/groovy

It’s essentially one of your options except the groovy path needs to be at the end.

That should behave like Run for project (without save). If you want to save the results in the project, you need to add --save (or -s). Well, that’s what you should need… except for a bug in v0.2 that means this doesn’t work. The bug report includes a workaround (add a line to the script if you need to save the data files in the project).

If you want Run for a single, you can use --image=image_name. There I’m afraid we have an inconsistency in the documentation: it is the name of the image as it appears in the project that you need to provide, not the full path to the image.

Both these things are fixed for the next release.

1 Like

Hi Pete,
thanks again for your fast reply - I tried it as you with:
/path/to/qupath -p path/to/project path/to/script
but actully it doesnt work … in the log of the started QuPath it say’s, that it wants to open an image, not an script:

It looks like you’re missing the script after the .exe. This needs to come first.

This is what turns on the ‘script subcommand’, and changes how the remaining arguments are understood; without that, QuPath’s command line expects to be given an image to open instead of a script to run.

Tried a couple of combinations, but the only last one opens QuPath

Ah ok, the script subcommand shouldn’t open QuPath - it should run the script without opening the user interface. There is no way to launch the QuPath user interface and run a script from the command line.

Thanks again,
makes a lot of sense
very kind of you to deal with all the little problems of the community :slight_smile: keep crushing it!

1 Like