Jump to content
Sign in to follow this  
AndyS01

Need to get a list of selected files/folders

Recommended Posts

AndyS01

I'm trying to write a "SendTo" script that does a 'find' on all selected files and folders and writes the found names to a file.

Because I ran into "arg list too long", I decided to try an AutoIt script that calls an 'open' dialog box (FileOpenDialog).

However, this dialog only returns the file names not the folder names (hence the name FILEopendialog :P ).

I need to somehow hook into the XP Windows Explorer's dll to see which file and folder names have been selected and process them.

If anyone can point me to code that does something like this, I would appreciate it.

Andy

Share this post


Link to post
Share on other sites
Melba23

AndyS01,

I cannot help with the Explorer hook, but I can suggest some Autoit functions that might help you achieve what you want to do:

FileOpenDialog (which you already know) selects files

FileSelectFolder selects folders (as you might have guessed!)

Put these into an array/string as you go along and you have your list to write using FileWrite.

If the files share a common pattern (same name or extension) then FileListToArray might prove useful as it does what it says - within limits as it is not recursive. If you need a recursive version, I have one which I could post.

I hope this helps - or at least gives some food for thought.

M23

Edit: Welcome to the forums, by the way!

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
AndyS01

Almost, but not quite. What the script I'm writing does is to create a text file containing all of the files, folders and sub-folders based on the selected files and folders. The selection is done in an Explorer window, then the window is right clicked to bring up the context and SendTo menu, where the call to my script is.

Because I don't know how to hook into the explorer dll, I'm trying to write an AutoIt script to do the same thing.

Share this post


Link to post
Share on other sites
martin

Almost, but not quite. What the script I'm writing does is to create a text file containing all of the files, folders and sub-folders based on the selected files and folders. The selection is done in an Explorer window, then the window is right clicked to bring up the context and SendTo menu, where the call to my script is.

Because I don't know how to hook into the explorer dll, I'm trying to write an AutoIt script to do the same thing.

I think ProgAndy has solved this for you here.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Anteaus

Alternatively, a crude (but effective) way to do this is to call on the DIR /B function of the command processor:

$runstr=@comspec & " /c dir c:\mymusic\*.mp3 /b /s >dirlist.txt

run($runstr)

will generate a file listing. You can then read dirlist.txt into a script and filter as required.

The more sophisticated way is to use the FileFindFirstFile.. FileFindNextFile.. functions, but this involves a lot more effort.

Share this post


Link to post
Share on other sites
CodyBarrett

command prompt MIGHT be more usefull, because it lists them automaticaly and autoit uses a loop.... whatever you want if you want less lines (only like 5 or so) use the CMD and if you want loop use filefindfirstfile()

Share this post


Link to post
Share on other sites
GEOSoft

Alternatively, a crude (but effective) way to do this is to call on the DIR /B function of the command processor:

$runstr=@comspec & " /c dir c:\mymusic\*.mp3 /b /s >dirlist.txt

run($runstr)

will generate a file listing. You can then read dirlist.txt into a script and filter as required.

The more sophisticated way is to use the FileFindFirstFile.. FileFindNextFile.. functions, but this involves a lot more effort.

You don't need to send it to a file. Just send it to the stdout stream.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
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
Sign in to follow this  

×