File Drag and Drop?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

File Drag and Drop?

Post by JRL » Tue Mar 19, 2013 5:11 pm

Anyone found a way to capture file names dropped on a Macro Scheduler dialog?

User avatar
Meryl
Staff
Posts: 124
Joined: Wed Sep 19, 2012 1:53 pm
Location: Texas
Contact:

Post by Meryl » Thu Mar 21, 2013 4:07 pm

Anyone know the answer? I'd love to know.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Mar 21, 2013 8:00 pm

As far as I know the only way an app can do that is by first calling DragAcceptFiles and then hooking the WM_DROPFILES message and responding to it. While you can do the first using LibFunc there's no way in Macro Scheduler to do the latter. Sorry.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Mar 21, 2013 9:31 pm

This is the best I've come up with. The idea actually came to me in a dream last night.... I know, how sad... Typed it up today and found that there is an issue with Win7 not killing the explorer.exe window when the script ends so I added a killprocess at the end.

What this does is create a directory under the temp folder called "DragAndDropSite". It then opens Windows Explorer at the DragAndDropSite folder. Finally we have our Macro Scheduler dialog SetParent on the Explorer window so the Explorer window is actually in the dialog. Any files dragged and dropped on the dialog are actually dropped on the Explorer window. That's all the sample does but from there the dropped files are isolated to a specific folder and can be manipulated to suit.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  BorderIcons = [biSystemMenu]
  Caption = 'Drop Files Here'
  ClientHeight = 200
  ClientWidth = 200
  Color = 255
end
EndDialog>Dialog1

CreateDir>%temp_Dir%DragAndDropSite
Let>RP_WindowMode=0
Run>explorer %temp_Dir%DragAndDropSite
WaitWindowOpen>DragAndDropSite*
Wait>0.5
GetWindowHandle>DragAndDropSite*,DaDhndl

LibFunc>user32,SetParent,SPres,DaDhndl,Dialog1.Handle

Let>Win_UseHandle=1
  ResizeWindow>DaDhndl,1000,1000
  MoveWindow>DaDhndl,-300,-300
  GetWindowProcess>DaDhndl,Explorer_ID,Explorer_Name
  SetFocus>DaDhndl
Let>Win_UseHandle=0

Show>Dialog1,res1
StringReplace>OS_VER,NT.,,OS_VER
If>OS_VER>5.5
  KillProcess>Explorer_ID
EndIf


User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Mar 22, 2013 8:46 am

Cunning :-)
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: File Drag and Drop?

Post by Grovkillen » Thu Feb 18, 2021 8:30 am

Any new takes on this? I'm thinking that perhaps we could be allowed to have the dialog registered as a dragdrop target in order to have the file info passed to the drop event?
Let>ME=%Script%

Running: 15.0.27
version history

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1380
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: File Drag and Drop?

Post by Dorian (MJT support) » Thu Feb 18, 2021 10:17 am

Not that I am aware of, but I will ask Marcus.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1380
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: File Drag and Drop?

Post by Dorian (MJT support) » Fri Feb 19, 2021 10:23 am

Marcus confirmed. This is not something we are currently planning to add.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: File Drag and Drop?

Post by Grovkillen » Fri Feb 19, 2021 10:43 am

Ok, thanks for the feedback. I will have to go the explorer.exe route with having the user drop their file onto the EXE icon in the Explorer. It'll do for now.
Let>ME=%Script%

Running: 15.0.27
version history

Franklin
Newbie
Posts: 18
Joined: Mon Dec 14, 2015 5:14 pm

Re: File Drag and Drop?

Post by Franklin » Sat Feb 20, 2021 1:05 pm

Another possible take on this is to use Selenium WebDriver

Destination can be a local source

References for code found Here:
https://www.guru99.com/drag-drop-selenium.html
https://www.browserstack.com/guide/drag ... -selenium

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts