I have a button on the DO toolbar that executes a 'Script Function' to move the last file downloaded to my Downloads folder to whatever folder is active in my lister. The script is one you gave me here:
The button works fine on my installed DO. I have the same button on a USB drive licensed DO that I use on a work laptop. The button doesn't work there. The only difference in the script is that I edited the path on the USB DO to match the download folder path on the laptop, which is different than the installed DO. How to troubleshoot?
Also, just for my understanding, why can I locate that script by typing the keyboard shortcut on the Keys tab of the Customize Toolbar interface, but I don't see it listed in the User-defined Commands section of the Commands tab of that same interface?
Is there any error message or does nothing happen at all?
Can you show us the edited lines? It might just be something wrong there. For example, \ characters in JScript strings need to be doubled, i.e. \\, which often messes up Windows paths if they're pasted into the code.
It should be under Script Commands in the same list.
User-Defined Commands are similar to Script Commands, in that they can define a command which other things can run, but also different in that they don't use scripting and are more simple / less powerful.
If you're familiar with the button editor, the distinction is similar to "Standard Function" vs "Script Function" there.
When I click the button, nothing happens, no error message. The script is:
var cmd = clickData.func.command;
cmd.deselect = false;
var newest = null;
var folderEnum = DOpus.FSUtil.ReadDir("C:\Users\username\Dropbox\download folder", false);
var item = folderEnum.next;
if (!item.is_dir && item.name != "desktop.ini")
if (newest == null || newest.modify.Compare(item.modify) < 0)
newest = item;
if (newest != null && DOpus.Create.Date() - newest.modify < 10 * 60 * 1000)
// "Copy HERE" doesn't work with scripting; use SetDestTab instead.
cmd.RunCommand('Copy MOVE FILE="' + newest + '"');
Strangley, I don't see the script under Script Commands, and it doesn't show when I search for it. In the Command Editor, the script label is "Move last download here", but a search for "move" in the interface search doesn't show it. Is the name of the script not the same as the label?