File Drag and Drop?
Moderators: Dorian (MJT support), JRL
File Drag and Drop?
Anyone found a way to capture file names dropped on a Macro Scheduler dialog?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
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?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
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.
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
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
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?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: File Drag and Drop?
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?
- Dorian (MJT support)
- Automation Wizard
- Posts: 1389
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: File Drag and Drop?
Not that I am aware of, but I will ask Marcus.
Yes, we have a Custom Scripting Service. Message me or go here
- Dorian (MJT support)
- Automation Wizard
- Posts: 1389
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: File Drag and Drop?
Marcus confirmed. This is not something we are currently planning to add.
Yes, we have a Custom Scripting Service. Message me or go here
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: File Drag and Drop?
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.
Re: File Drag and Drop?
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
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