Skip to content

Conversation

@leomeyer
Copy link

@leomeyer leomeyer commented Jan 15, 2026

Background

I'm using my scanner (CanoScan 4400F) to archive documents as PDFs. Business documents need to be stored in a Papra DMS ingestion folder while personal or household documents have to be archived in separate folder structures. I can therefore not currently use a common default file path in the PDF settings but instead have to select the path manually for each document which is tiresome.

Proposed Solution

The proposed changes attempt to resolve this issue by adding a new command line argument:

/config=<name>

If such a name is specified it is
a) used as a suffix for the XML file used to load and store user configuration values, and
b) displayed in the main window title.

If no such argument is used the behaviour is unchanged. If multiple /config=... arguments are used only the first one has an effect.

Example

For example, specifying /config=Business results in the file config_Business.xml to be used for the user configuration values.
Additionally the title of the main window will display the configuration name:

image

Any changes to settings values will be saved in config_Business.xml. Other user configuration files are not affected.

Special cases

While best avoided, spaces in configuration names can be used by putting the complete argument in quotes, e. g. "/config=My Business". The configuration name is being checked for invalid file name characters. If any are present, or if its trimmed string is empty, the argument is ignored.

Usage

This option is mainly intended to be used for AutoPlay event handlers that are applied when buttons on the scanner are pressed. Regular users of the GUI will probably not use it much. Perhaps it can be useful for batch processing as well but I have not yet used that.

On Windows the event handlers for the scanner buttons can now be modified in the registry to use different configurations of with each can define a different default file path. Once the GUI is up and running subsequent invocations (i. e. scanner button clicks) do not change the configuration used at startup even if a command line argument should specify a different one. The window needs to be closed in order to be able to use a different configuration.

Example:
To use the configuration "Business" when clicking the leftmost button (on a CanoScan 4400F) add the argument /config=Business to the value of Cmdline under the key Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{6bdd1fc6-810f-11d0-bec7-08002be2092f}\0004\Events\PushButtonPushed4\{1C3A7177-F3A7-439E-BE47-E304A185F932}:

image

Platforms

Windows: Functional (tested on Windows 10)
Linux: Functional (tested on Linux Mint 22)
Mac OS: Untested

Addendum

I have not added or modified tests or documentation. I hope this patch is useful for the project; if there is anything else I can do please let me know.

@leomeyer leomeyer marked this pull request as ready for review January 15, 2026 15:45
@leomeyer leomeyer marked this pull request as draft January 15, 2026 16:07
@leomeyer leomeyer marked this pull request as ready for review January 15, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant