Something like a"foreach" function?


I currently have the following button created to do the following :

  1. copy the highlighted filename to the clipboard.
  2. extract the highlighted .rar file
  3. delete the highlighted .rar file
  4. add extracted *.jpg files to a .7z archive with the same filename of the original .rar archive.
  5. delete all *.jpg files in current pane.

<?xml version="1.0"?> <button display="both" label_pos="right"> <label>Extract AND compress to 7zip and DELETE rar (NO subdirs !!!)</label> <tip>Extracts files to current directory and copy the filename to the clipboard and DELETE the archive</tip> <icon1>C:\Program Files\WinRAR\WinRAR.exe,0</icon1> <icon2>C:\Program Files\WinRAR\Uninstall.exe,1</icon2> <function type="normal"> <instruction>@firstfileonly </instruction> <instruction>Clipboard COPYNAMES=nopaths REGEXP (.*)\.[^.]* \1</instruction> <instruction>&quot;/programfiles\WinRAR\WinRAR.exe&quot; x {file$}</instruction> <instruction>Delete {file$} RECYCLE QUIET </instruction> <instruction>&quot;/programfiles/7-zip\7z.exe&quot; a -mx9 -ms64g -mmt=on {clip}.7z *.jpg </instruction> <instruction>Delete FILE &quot;*.jpg&quot; NORECYCLE QUIET </instruction> </function> </button>

Is it possible to extend this function so that I can select multiple .rar archives and click that button, and it does as the button but for each .rar file that was selected ?

You could move it into a User Command and then make your main button call that for each file.

IMO, you're doing something complex enough, and that isn't really using Opus for anything but passing the selected filenames, that you'd probably be better off moving the whole thing into a VBScript that you call from Opus (just passing the filenames to the script).