How To Drag And Drop

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
fthomas
Pro Scripter
Posts: 91
Joined: Fri Oct 03, 2008 6:40 pm

How To Drag And Drop

Post by fthomas » Sun Sep 14, 2014 8:01 pm

Good day all,

I've come across a real problem in automation. I'm using easy video suite and the windows application will only let you add new videos for compilation by clicking in a directory, and dragging it into it's interface. I can find the spot for the interface, but grabbing the file and dragging and dropping - I'm totally stumped!

Help

Frank

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

Re: How To Drag And Drop

Post by Marcus Tettmar » Mon Sep 15, 2014 10:29 am

A drag drop is made up of the following sequences:

Move Mouse to source location.
Mouse Down
Move Mouse to destination location
Mouse Up.

So, assuming you know the source and destination locations or can determine them (e.g. using image recognition or text positioning or FindObject or something), you would simulate this with:

Code: Select all

MouseMove>x_source,y_source
LDown
MouseMove>x_dest,y_dest
LUp
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

fthomas
Pro Scripter
Posts: 91
Joined: Fri Oct 03, 2008 6:40 pm

Re: How To Drag And Drop

Post by fthomas » Mon Sep 15, 2014 4:43 pm

Thanks Marcus,

Another quickie question, is there a way to open windows and place them in a particular spot and size them too?

Frank

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

Re: How To Drag And Drop

Post by Marcus Tettmar » Mon Sep 15, 2014 6:09 pm

Yes, you have the following commands:

MoveWindow https://www.mjtnet.com/manual/movewindow.htm
ResizeWindow https://www.mjtnet.com/manual/resizewndow.htm
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

fthomas
Pro Scripter
Posts: 91
Joined: Fri Oct 03, 2008 6:40 pm

Re: How To Drag And Drop

Post by fthomas » Wed Sep 17, 2014 4:58 pm

Thanks Marcus,

I've discovered these wonderful commands and am using them in my script. Finally got things working nicely.

One thing that I discovered was to allow enough time, especially when opening/closing windows for things to stabilize. I was amazed that I had to permit a good 3-5 sec lag even after the window on one app was opened, or else I'd get erratic behavior.

Frank

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