queensoft Posted April 18, 2023 Posted April 18, 2023 (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. Edited April 18, 2023 by queensoft add screenshot
Nine Posted April 18, 2023 Posted April 18, 2023 Can you drop a file manually from File Explorer ? 3 hours ago, queensoft said: But now I'm trying to use it with another custom software. Or talk to the developers... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
queensoft Posted April 19, 2023 Author Posted April 19, 2023 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).
Nine Posted April 19, 2023 Posted April 19, 2023 If manual d&d is not working from File Explorer, my guess is that the window doesn't have the WS_EX_ACCEPTFILES extended style. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
queensoft Posted April 19, 2023 Author Posted April 19, 2023 Drag&drop works perfectly from Total Commander (run as admin). And from Explorer on another computer (I have video recording from client, running Windows 11). I think it's a matter of permissions, even tough there's only one admin account. I tried running Explorer as admin ( https://www.technewstoday.com/run-file-explorer-as-admin/ ), still does not work.
Nine Posted April 19, 2023 Posted April 19, 2023 (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 April 19, 2023 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
rsn Posted April 19, 2023 Posted April 19, 2023 @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.
queensoft Posted April 19, 2023 Author Posted April 19, 2023 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now