Acquire File Names List via Windows Explorer Selection

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Acquire File Names List via Windows Explorer Selection

Post by JRL » Tue May 23, 2017 6:10 pm

In order to work this script needs to be compiled. After compiling a shortcut to the executable needs to be placed in your "sendto" folder. You can easily get to the sendto folder by opening Windows Explorer and typing sendto (one word) in the location field then pressing Enter.

After the shortcut is placed in the sendto folder you can open Windows explorer and browse to a location then select any group of files using standard selection practices. After the files are selected right click on one of them and in the right click menu find and select "Send To". In the Send To menu find and select your shortcut to this compiled script. After clicking the shortcut a list of the selected files should appear in a Macro Scheduler message box. The same file list is also placed in the clipboard so can be pasted into any text editor.

The script could be expanded to be used for any purpose for which selecting file names via Windows Explorer might be handy.

Before posting this I searched the forum for "sendto" looking to see if this method had already been posted. I see HERE that Phil Pendlebury posted an FTP uploader that contains a similar process and makes use of the sendto folder's capability. Phil's is buried in a full fledged application and might not be easily discerned, so I decided to go ahead and post this version.


Code: Select all

Let>msg_width=1000
Let>msg_height=700
Let>vFileList=

Separate>Command_line,:\,vLine

Let>CommandFileDrive=vLine_1
StringReplace>vLine_1,",,vLine_1
StringReplace>vLine_2,",,vLine_2
Length>vLine_2,vCommandFileNameLen
Midstr>vLine_2,%vCommandFileNameLen%,1,DriveLetter
Midstr>vLine_2,1,{%vCommandFileNameLen%-2},vRes
Let>vCommandFileName=%vLine_1%:\%vRes%

//vCommandFileName is the path and name of this exe file.

Let>kk=2
Repeat>kk
  Add>kk,1
  Let>value=vLine_%kk%
  StringReplace>value,",,value
  Length>value,vFileNameLen
  If>%kk%<>%vLine_Count%
    MidStr>value,1,{%vFileNameLen%-2},value
    Concat>vFileList,%DriveLetter%:\%value%%crlf%
  Else
    Concat>vFileList,%DriveLetter%:\%value%
  EndIf
Until>kk=vLine_Count

PutClipBoard>vFileList
MDL>vFileList

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