I use SelectEx to randomly select audiofiles to put on CD, stick, etc. as regular button. Now I would like to create a GUI-version. As I am not good in scripting, can someone please finish it?
In its window you can enter max. size to be selected (for example 700 MB for CD), the radio-buttons are for choosing filetype (mp3/all files).
Code:
<?xml version="1.0"?>
<button backcol="none" display="icon" textcol="none">
<label>SC_SelectEx_Random_Size_GUI-beta</label>
<tip>Gewählte Dateigesamtgröße zufällig markieren</tip>
<user_label>Größe zufällig markieren</user_label>
<icon1>#rename4</icon1>
<function type="script">
<instruction>@script JScript</instruction>
<instruction>function OnClick(clickData) {</instruction>
<instruction> var cmd = clickData.func.command;</instruction>
<instruction> var dlg = clickData.func.Dlg();</instruction>
<instruction> dlg.window = clickData.func.sourcetab;</instruction>
<instruction> dlg.template = 'mydlg';</instruction>
<instruction />
<instruction> var input1 = dlg("input1");</instruction>
<instruction> var radio1 = dlg("radio1");</instruction>
<instruction> var radio2 = dlg("radio2");</instruction>
<instruction> </instruction>
<instruction> var retVal = dlg.Show();</instruction>
<instruction> if (retVal == radio1) var filetype = ' ';</instruction>
<instruction> if (retVal == radio2) var filetype = '\.mp3$';</instruction>
<instruction />
<instruction> var cmdLine = ('"SelectEx RANDOM FILES' +filetype+ 'MAXSIZETOTAL='+input1+'MB ITEMCOUNT=999999 DESELECTNOMATCH MAKEVISIBLE"');</instruction>
<instruction> DOpus.Output(cmdLine);</instruction>
<instruction> cmd.RunCommand('dopusrt /argsmsgbox ' + cmdLine);</instruction>
<instruction>}</instruction>
<instruction />
<instruction />
<instruction>// cmd.RunCommand('"SelectEx RANDOM FILES' +typVal+ 'MAXSIZETOTAL='+sizeVal+'MB ITEMCOUNT=999999 DESELECTNOMATCH MAKEVISIBLE"');</instruction>
<instruction>==SCRIPT RESOURCES</instruction>
<instruction><resources></instruction>
<instruction> <resource name="mydlg" type="dialog"></instruction>
<instruction> <dialog fontsize="8" height="118" lang="german" title="Größe zufällig markieren" width="173"></instruction>
<instruction> <control halign="left" height="8" title="Wie viele MB sollen zufällig markiert werden?" type="static" valign="top" width="149" x="12" y="8" /></instruction>
<instruction> <control halign="left" height="12" name="input1" title="700" type="edit" width="36" x="12" y="24" /></instruction>
<instruction> <control checked="yes" height="10" name="radio2" title="MP3-Dateien" type="radio" width="64" x="12" y="73" /></instruction>
<instruction> <control height="10" name="radio1" title="Alle Dateien" type="radio" width="51" x="12" y="58" /></instruction>
<instruction> <control halign="left" height="8" title="MB gesamt" type="static" valign="top" width="37" x="51" y="26" /></instruction>
<instruction> <control halign="left" height="8" title="Dateityp:" type="static" valign="top" width="30" x="12" y="44" /></instruction>
<instruction> <control close="0" height="14" name="button1" title="Ok" type="button" width="72" x="45" y="95" /></instruction>
<instruction> </dialog></instruction>
<instruction> </resource></instruction>
<instruction></resources></instruction>
</function>
</button>