Script Dialog behaviour with {f}

When the attached demo $JT (just testing) VBscript command is executed with no argument it presents a simple dialog prompt as expected. Likewise when executed as $JT {s}. However, when executed as $JT {f} and one or more folders, or two or more files are selected, the lister drops into "file function" mode until all dialogs are processed by the user.

When more than one item is selected dialogs are presented serially, which makes sense. My questions are..

[ol][li]Why is "file function" mode invoked when only one folder (and no files) is selected? There is only one item.[/li]
[li]Why does the lister obscure the dialog when "file function" mode first kicks in?[/li][/ol]
My test command is attached as an OSP. The relevant small section of code which opens the dialog is:

Dim WhatWasReturned, WhatWasPressed, Msg, Title, NewVal Msg = "User instructions go here.." Title = "Dialog Description" NewVal = "Default text" WhatWasReturned = DOpus.dlg.getstring(Msg,NewVal,0,"OK|Cancel",Title,0,WhatWasPressed)
If it helps, I made a short video to demonstrate the background to my questions.

Regards, AB
Just Testing.osp (949 Bytes)

Using {f} will run your command once per file and show a progress dialog while waiting for it to finish.

You would be better off making the command be able to enumerate the selected files itself, and only running the command once. That is how all the internal commands workk as well.

The dialog going behind the lister indicates it is not using the lister as its parent. You are using the DOpus.dlg object which is only good for dialogs that exist on their own with no connection to a lister. You can set the dlg object's parent window or use the dlg object supplied by something more appropriate, such as the active folder tab, which will have set the parent window for you on the dlg object it provides.

Thanks for the pointer Leo. I should have spotted that myself. Changing DOpus.Dlg to ScriptCmdData.Func.Dlg keeps the dialog on top of the lister

The behaviour when a single folder is selected seems wrong. A single selected item, whether it's a file or a folder, should trigger a single execution of the command and therefore no progress dialog. Anyway, I don't have a practical problem with this - it's just an oddity that I came across whilst fiddling with script dialogs.

Regards, AB

You often still want to know when a command has finished, even if it is only running on one file, so {f} may not treat a single file as a special case.