end2endzone / ShellAnything

ShellAnything is a C++ open-source software which allow one to easily customize and add new options to *Windows Explorer* context menu. Define specific actions when a user right-click on a file or a directory.
MIT License
180 stars 27 forks source link

Show a confirmation prompt as an action before proceeding #89

Closed end2endzone closed 2 years ago

end2endzone commented 3 years ago

Is your feature request related to a problem? Please describe. I would like to create confirmation prompts that ask the user if he really wants to proceed with an operation. The prompt would display a custom message with an OK and Cancel buttons.

Describe the solution you'd like For example:

<prompt type="okcancel" name="proceed" title="Are you sure you want to proceed with the operation?" onok="/continue" oncancel="/abort" failoncancel="true" />

If the user has selected OK, the property proceed should be set to value /continue. If the user has selected Cancel, the property proceed should be set to value /abort. If the attribute failoncancel is set to true, the action should fail if the user has clicked on Cancel button.

Describe alternatives you've considered There does not seems to exists an action that can cancel the operation.

Additional context N/A

end2endzone commented 3 years ago

Another alternative solution would be to implement a <fail /> action. The action could have multiple different attributes to fail the action based on different criteria.

To get a confirmation message before proceeding, one could do something like :

<prompt type="yesno" name="proceed" title="Are you sure you want to proceed with the operation?"
        valueyes="true" valueno="false" />
<fail iffalse="${proceed}" />
<exec path="..." />

The above example would fail since the property proceed is set to false when one answer "no" the to prompt message. If the user select yes, the property proceed is set to true which does not fail the <fail/> action and the execution continue to the next action.

Other possible attributes includes :

end2endzone commented 2 years ago

The xml element should be named <stop> instead of <fail> to indicate that it is a command and not a fatality.