Drag-and-Drop with Desktop files

R.H. roland.huettmann at gmail.com
Mon Mar 18 10:54:35 EDT 2019

Sub-Subject: Detecting user selected files/folders in Windows and other

I like to refer to the last message from -hh (see reference below)
regarding Windows possibility of detecting selected items (folders, files,
icons as such) on the Windows Desktop. The solution -hh already provided
when items are selected in any Windows Explorer. The Desktop is not part of
that and basically a special Windows ListView control.

It is correct that items selected on the Windows Desktop are deselected
when another window is becoming active. So, using LiveCode would not work
this way.

What could work though is a service that is running in Windows OS and
detects selected items of the Windows Desktop and their status of type,
selection and position, etc. The service could be started when opening
LiveCode and shut down when closing it. Data would be saved to a temporary

So, switching focus to the LiveCode window would allow reading the temp
file with the list of selected items that have been selected BEFORE the
user activated the LiveCode window.

It is too much of a hassle at the moment for me writing such a program that
runs in the background. Nevertheless, for C/C++ and C# there are some code
fragments around that are public and doing just that.

For my clients, it is a very good solution to be enabled now to select
files/folders and read their path into LiveCode. For Desktop items in
Windows, I just tell them to move them into a folder and select them within
this folder (which is then an Explorer window). So, that works with scripts
-hh provided.

THIS IS MORE CONVENIENT THAN DRAG-AND-DROP of files/folders even though I
also support drag-and-drop plus the standard file/folders selection window.

Many thanks again. And I hope the same will work on MacOS and Linux as -hh
also provided solutions there, and I saw others providing. (I am not using
both others OSes since my clients are 100% Windows only.)

--Message: 16
--Date: Thu, 14 Mar 2019 21:33:32 +0100
--From: hh <hh at hyperhh.de>

--But there is NO method to get the selectedItems from the virtual desktop
--Moreover, as you may notice, the selected items are deelected when you
--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.

Kind regards and thanks to all

More information about the use-livecode mailing list