Jump to content

Drag and Drop many files to a compiled script


 Share

Recommended Posts

I'm using $CmdLine currently. But it has windows limitations.

So while not found the answer, I'm asking if there's a way to do it without $CmdLine and Autoit?

Maybe with some workaround? I really need to update my knowledge on that term to then update my scripts where I use drag and drop a lot if not always.

Thank you.

Link to comment
Share on other sites

8 hours ago, Andreik said:

Drag and drop is possible but you should be more specific. A compiled script can be a console application or it might have a GUI where you drop files.

Thank you for the reply. I use GUI only to show the progress of processing with a progress bar but that's not the point atm. What I do is I select numerous of files and drop on a compiled script .exe. 

Link to comment
Share on other sites

..you can only pass up to 2000 characters on command line but is a window limitation. You will process 15 files max from drag and drop and again is a windows limitation.
Maybe you can use a different approach to solve your issue ?, think of alternate ways to go about it. 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

10 minutes ago, argumentum said:

..you can only pass up to 2000 characters on command line but is a window limitation. You will process 15 files max from drag and drop and again is a windows limitation.
Maybe you can use a different approach to solve your issue ?, think of alternate ways to go about it. 

I know the basic functions of autoit pretty well, and I have a lot of tools I made and use daily to convert a bunch of files from one state to another. But this limitation has always been making me crazy. I'm on vacation rn and thought I could update my tools. That's why I'm here.

I know about limitation of windows, I mentioned it in the first post. I simply want to select 10K of files, drop them on the script.exe, see the progression of converting and get converted files.

Link to comment
Share on other sites

I don't have a folder with 10K files in it, but this works with 400 files, providing an array with each file in its own cell. Of course, you have to first select many files using Explorer, then run this code (even uncompiled) and handle the drop at your own pace.

_ClipBoard_Open(0)

Local $data = _ClipBoard_GetData($CF_HDROP)
Local $bin = BinaryMid($data, 21, BinaryLen($data) - 24)
Local $c, $s
For $i = 1 To BinaryLen($bin) Step 2
    $c = BinaryMid($bin, $i, 2)
    $s &= ($c <> 0 ? ChrW($c) : "|")
Next
$aFiles = StringSplit($s, "|", 3)
_ArrayDisplay($aFiles)

; Close the clipboard
_ClipBoard_Close()

 

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

@jchd that's great (never used $CF_HDROP before). What about this, quickly done, no error checking : error should be checked, or we could use a simple ClipGet() in this case :D

#include <Array.au3>
#include <Clipboard.au3>
#include <WinAPISysWin.au3>

_ClipBoard_Open(0)
Local $aSelected = _WinAPI_DragQueryFileEx(_ClipBoard_GetDataEx($CF_HDROP))
_ArrayDisplay($aSelected)
_ClipBoard_Close()

Just tested on thousand of files in Windows, System32, after selecting and copying all of them to clipboard (Ctrl+a, Ctrl+c)
Edit: I tried this after reading what follows on msdn :

CF_HDROP (15) A handle to type HDROP that identifies a list of files. An application can retrieve information about the files by passing the handle to the DragQueryFile function.

Edited by pixelsearch
Link to comment
Share on other sites

@pixelsearch I tried this way since we were told that about 15 files would be the Windows limit. Didn't look further.

@Tosyk why can't you convert smaller batches of files, rather than trying to convert 10K at once?

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

@argumentum not sure YGYL0's script (the link you provided) would work if drag & drop was done on an exe file icon, without an opened GUI, when plenty of files are involved.

What I see in his script is that he bypass the Windows limitation (which is not 15, it depends on the length of the path). By the way, without his script, I just could drag & drop 40 files on an exe because their path was short (like C:\Temp3\filenames). When paths are longer, then the number of files you can drag & drop on an exe is reduced, probably because of the 2000 characters limit you indicated.

@Tosyk if there is no way to achieve your goal and as it seems important to you, then I suggest you just create a small GUI in your script, with a droppable zone, then you'll be able to drop thousands of file names in one pass, like in a script I wrote several years ago :

Resize-image-files-v8.png

Before selecting a bunch of files from Windows Explorer (or XYplorer I use in its place), I just double click the icon of the script (the icon IS placed on the desktop for an easy & immediate access), select no matter how many files, drag & drop them on the droppable blue zone in the GUI, it never failed (the droppable zone is blue and active only when the radio button "Drag them here" is checked)
Edited by pixelsearch
Link to comment
Share on other sites

@ioa747 please never think I don't want to share it but the last versions and their hotkeys are very much linked to the software I use (XYplorer, ACDsee, Opera, FF etc...) plus they all require a special reworked version of "ArrayDisplayInternals.au3" with functions named for example Func _ArrayDisplay_Is_Calling(), tweaks etc... which makes the script impossible to run outside of my computer, without downgrading it.

When I have time, I'll try to check if an older release (including drag & drop) could be more suitable to AutoIt users, but it will take time because of all the releases done these last years :

Resize-image-files-history.png
Edited by pixelsearch
Link to comment
Share on other sites

I'd recommend Faststone Resizer free for home use and w/o nasties. Lots of options there and very fast.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

14 hours ago, jchd said:

why can't you convert smaller batches of files, rather than trying to convert 10K at once?

Because I'm doing it right now, and this is not really convenient

13 hours ago, argumentum said:

Why the need to DnD 10,000 files on an exe ?

I'm working with a huge amount of data and assets on my job, so it's almost a day-to-day task

13 hours ago, pixelsearch said:

if there is no way to achieve your goal and as it seems important to you

isn't it really? I still hope there's a way )

13 hours ago, pixelsearch said:

then I suggest you just create a small GUI in your script

Thank you, I have thought about this. Unfortunately, it makes my workflow more complicated and by using autoit I was hoping to improve my work. Actually, the main intention of the tool is to automate the processes.

I have a bunch of files: I select some of them -> right click -> Send to -> choose the my autoit script.exe -> GUI appears -> I select options and click OK.

Edited by Tosyk
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...