Tell if anything is selected in button?

How can I tell if a file or folder is selected by the mouse?
I can do some simple programming, I'll try this

@if:{filepath}
@confirm yes
@if:else
@confirm no

This doesn't work, how can I do something similar?

There are a few different modifiers for this, depending on exactly what you want to do. Search Command Modifiers for "selected" to find them all.

I can not operate jscript and vbcript, and there is no incentive for me to learn this skill, I passed two parameters {filepath} and {sourcepath}, and then through the java processing logic and data, and finally called cmd to achieve the function I need, although the efficiency will be slower, but I can achieve a high degree of customization of the function

There's no need for JScript or VBScript here. Look at @dirsonly, @filesonly, @disablenosel, @hidenosel on the page I linked.

All the commands in the document is not difficult to understand, but the important thing is how to combine the various commands to form a logical processing, fragmented examples are difficult to play a role, of course, I also tried to combine several examples, which is not explained in the document, I think this is very inefficient

What do you actually want to do?