How to change the desktop background on a PC via KNIME

How to change the desktop background on a PC via KNIME.
My desktop background breaks every time for some reason. I would like to change it via KNIME

Hi @Nuke_Attokurov,

I haven’t tried this and KNIME wouldn’t have sprung to mind as the obvious tool for this task , but in theory if you can change the desktop background using Java, then it is potentially possible.

Searching for a Java solution I found this

There are several suggestions there for doing this in Java so a Java Snippet could potentially be coded to do the job.

Do you know Java? If so you could maybe try that route? I’ll have a play at some point too but haven’t time right now.

1 Like

@Nuke_Attokurov, I decided I would give it a go :slight_smile:

Try this:

I made it a component, but the internals are that it uses a Java Edit Variable node, (which is essentially the variable-only version of Java Snippet) as I just wanted to pass it a variable instead of having to supply a data table.

The internals of the “snippet” are taken from the stackoverflow link I posted earlier.

This uses the Java JNA package which is not present by default in a java snippet but is easily added by switching to the “additional bundles” tab, searching for “jna” in the lower panel and adding the two bundles shown here:

4 Likes

Thank you very much. This is exactly what I needed

2 Likes

You’re welcome @Nuke_Attokurov. That was a fun way to start my day :slight_smile: I’ve never thought about it before but I can imagine having the desktop background change according to the stage of the workflow it’s got to, lol. Or put it in a loop for some disco effect :wink:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.