Drag-and-Drop with Desktop Files

hh hh at hyperhh.de
Thu Mar 14 16:33:32 EDT 2019


Hi,

I use MacOS or linux (on Raspi only), never really worked with windows.
I'm using Windows only to test my stacks/apps on the PC of my youngest son.

Scripting Host-WScript can execute JScript, the MS-extension of ECMAScript. It has a
lot of features. We probably can use a lot of these features via LC's shell.

I looked into that out of interest the first time last week. It is well documented:
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/wscript
And it seems to be better maintained than VBScript.

But there is NO method to get the selectedItems from the virtual desktop folder.

Moreover, as you may notice, the selected items are deelected when you activate
another window (as for example a LC window or an explorer window).

The only workaround I can see (besides using an answer file dialog or dragDrop) is:

1. launch document specialFolderPath("Desktop") --> open desktop folder in explorer
2. User should select the files in that window.
3. Use the already working method for explorer windows.

----
file "wscript1.js" (more compact output)

var shellWindows = new ActiveXObject("Shell.Application").Windows();
for (var i = 0; i < shellWindows.Count; i++) {
var w = shellWindows.Item(i);
var sel = w.Document.SelectedItems();
for (var j = 0; j < sel.Count; j++) {
var item = sel.Item(j);
WScript.StdOut.WriteLine(item.Path);
}
}





More information about the use-livecode mailing list