Jump to content

Recommended Posts

Posted (edited)

I'm using this script:

It is working with one piece of software I have (WinOLS, if anyone's interested).

But now I'm trying to use it with another custom software.

I can detect window & controls perfectly: handle, position, text, ControlClick is working perfectly on buttons and text boxes.

There are 2 text boxes, I need to simulate drag&drop to both, but nothing is working, there is no error, also no result.

Unfortunately, I cannot send you the custom program.

Here's my script snippet

$hWnd = WinGetHandle('[CLASS:WindowsForms10.Window.8.app.0.141b42a_r35_ad1]')
WinActivate($hWnd)
Sleep(333)

$pos1 = ControlGetPos('[CLASS:WindowsForms10.Window.8.app.0.141b42a_r35_ad1]', 'CreateScripts', '[NAME:textBox1]')  ; get position of left text box
$hWnd2 = ControlGetHandle('[CLASS:WindowsForms10.Window.8.app.0.141b42a_r35_ad1]', 'CreateScripts', '[NAME:textBox1]')

ControlClick($hWnd, '', $hWnd2)  ; this works perfectly, there's a blinking cursor inside text box
$r = _FileDragDrop($hWnd, 'd:\file.xxx', $pos1[0]+50, $pos1[1]+50);, '|', True) ; open file, using drag&drop operation

I have tried to set target to window handle ($hWnd) and control handle ($hWnd2) - both fail.

I have also tried the other functions, from script header, still no luck.

Image3.thumb.jpg.d768329eb6ea0aeeef16072606226cbb.jpg

Edited by queensoft
add screenshot
Posted

Manual drag&drop is working from Total Commander.

Manual drag&drop is NOT working from Explorer. The file used for drag&drop is on drive D:\folder\....

I use Windows 10 22H2, one account, administrator, UAC disabled.

I have added #RequireAdmin, still fail.

 

Talk to developers: already did.

The custom program has 2 buttons for opening files. :)I thought they are for something else. :(

File open dialog, send path+name is not that elegant as simulating drag&drop and all other buttons (which are working just fine).

Posted (edited)

When you do it manually from Explorer does the cursor change to a d&d cursor when hovering the edit box ?  If so then it is a question of privileges.

ps. I was able to reproduce your issue with my own edit box.  I am unable to d&d from Explorer if the script is run as admin, even if Explorer is run as admin.

 

Edited by Nine
Posted

@queensoft Running explorer elevated (not just admin) isn't supported and is very difficult to do. Windows 10 and later have a lot of things in place to prevent elevating the  explorer executable since running it elevated allows any child process to run elevated. Following the instructions at the link you provided doesn't actually work. Check your task manager and look under the "Elevated" column and you'll see that it always says "No" and any elevated attempts will re-launch as non or not at all.
 

A great way to illustrate is to launch a command prompt as NT Authority\SYSTEM (using PSEXEC or PAEXEC) and then try to run explorer from it. If the process starts (using /nouac for example), it won't be interactive at all. Otherwise it'll launch and immediately exit.

Posted

We're getting off track.

Drag&drop from explorer to custom program (from screenshot above) works on another computer, I have video recording.

Drag&drop simulation = this exact same script, but with another software (WinOLS), works on 4 different computers.

It's either a permission problem or a problem from the custom program. Window classes are different thatn usual:

CLASS:WindowsForms10.Window.8.app.0.141b42a_r35_ad1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...