Jump to content
Macro Express Forums

Macro to Copy/Move File/Flies to New Folder


Recommended Posts

Hi There,

 

I am looking for help to put together a macro that can do the following.

 

I will have a Windows 10  File Explorer Windows open and have selected various files (these files will be the result of a search, so will be located in different Folders)

 

So maybe Copying them to the Clipboard

 

1.  The Macro will display a list of predefined Target Directories.

2.  On clicking on one of the them it will move the file/files (details of which will be in the clipboard) to the selected  Directory.

 

I have spent a great deal of time trying to get this to work and to be honest given up. This is a last ditch effort to be pointed in the right direction

 

Below is my attempt at writing the macro

 

Any help will be most appreciated.
 

<CLIPBOARD COPY/>
<COMMENT Value="Extract the FILENAME from full path & filename."/>
<VARIABLE SET STRING Option="\x02" Destination="%Input%" NoEmbeddedVars="FALSE"/>
<VARIABLE SET INTEGER Option="\x0D" Destination="%Length%" Text_Variable="%Input%"/>
<REPEAT START Start="%Length%" Step="-1" Count="%Length%" Save="TRUE" Variable="%Index%"/>
<VARIABLE MODIFY STRING Option="\x09" Destination="%Char%" Variable="%Input%" Start="%Index%" Count="1" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%Output%" Variable="%Char%" NoEmbeddedVars="FALSE"/>
<END REPEAT/>
<VARIABLE SET INTEGER Option="\x0E" Destination="%nPosReversed%" Text_Variable="%Output%" Text="\\" Ignore_Case="FALSE"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%nPos%" Value1="%Length%" Value2="%nPosReversed%"/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%nPos%"/>
<VARIABLE MODIFY STRING Option="\x0A" Destination="%Input%" Start="1" Count="%nPos%"/>
<TEXT BOX DISPLAY Title="Result" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %Input%\r\n\\par \r\n\\par \r\n\\par \r\n\\par \r\n\\par \r\n\\par \r\n\\par \\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE" _COMMENT="Disable this when satisfied."/>
<COMMENT Value="Proceed with rest of macro."/>
<OPEN FOLDER Path="C:\\Users\\desmo\\Desktop\\Music Library 2018\\Favourite"/>
<VARIABLE SET STRING Option="\x00" Destination="%T4%" Value="C:\\Users\\desmo\\Desktop\\Music Library 2018\\Favourite\\" NoEmbeddedVars="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T4%" Value="%T4%%Input%" NoEmbeddedVars="FALSE"/>
<WAIT FOR WINDOW TITLE Title="Favourite" Partial="FALSE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="20"/>
<CLIPBOARD PASTE/>
<DELAY Flags="\x01" Time="1"/>
<WINDOW CLOSE Option="\x01" Title="Favourite" Partial="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
<DATE/TIME Format="dd/MM/yyyy HH:MM" Flags="\xB0" Date="25/12/2018 22:29:25" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="0" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%T3%" IsDateVar="FALSE"/>
<VARIABLE SET STRING Option="\x02" Destination="%T1%" NoEmbeddedVars="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T2%" Value="   - Moved to Favourite" NoEmbeddedVars="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T1%" Value="%T1%  %T2% %T3%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x10" Destination="%T1%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x00" Destination="%T4%"/>
<IF FILE EXISTS File="%T4%" Search_Path="FALSE"/>
<CLIPBOARD APPEND TEXT Filename="C:\\Users\\desmo\\Desktop\\Music Sorting Log.txt" Prompt="FALSE"/>
<TEXT BOX DISPLAY Title="File Copied Sucessfully" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs24 File has been moved to \\b Favourite \\b0 Folder\\b  \r\n\\par \\b0\\f1\\fs16 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x01" Delay="3"/>
<DELAY Flags="\x01" Time="3"/>
<ELSE/>
<TEXT BOX DISPLAY Title="File Copy Failed" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs24 The file copy \\b Failed \\b0 please check and retry\\b \r\n\\par \\b0\\f1\\fs16 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x01" Delay="3"/>
<DELAY Flags="\x01" Time="3"/>
<END IF/>

 

Link to comment
Share on other sites

Hi,

 

I'd like to help but I frankly don't understand your problem description. And obviously it's impossible to test your macro without the appropriate files and folders.

 

Can you explain again but in plainer terms. I'm guessing here, but something like this:

"I want to build a text file called 'Music Sorting Log.txt'. Each line will contain the full path and filename of...etc, etc".

IOW, what is your objective expressed in conversational terms?

 

There are several points I find vague or unclear.

What exactly is the status at activation? IOW, what is selected? A file in an Explorer folder? A filename, already in Edit mode (F2)? What type of files? (I'm guessing audio: MP3/WMA/WAV/etc?

 

You say:

1.  The Macro will display a list of predefined Target Directories.

But your macro doesn't appear to display a list.

 

2.  On clicking on one of the them it will move the file/files (details of which will be in the clipboard) to the selected  Directory.

But your macro doesn't prompt for any user clicking. And how can multiple 'details' (do you mean names?) all be in the clipboard?

 

As always, the devil is in the details!

 

 

Link to comment
Share on other sites

Here are some suggestions that may help:

 

1. There is a command to extract the filename from a full path. Take a look at the "Variable Set From File path" macro command.

2. Add a "Wait for File to be Ready" macro command before the "If File Exists"" macro command. Macro Express may get to the If File Exist command before Windows has finished copying the file.

3. Since you already have the filenames and file paths consider using the "Copy File/Files" macro command to copy the files. It is generally easier to copy the files using Macro Express instead of manipulating Windows File Explorer to copy files.

4. If you were to use descriptive variable names it would make your macro easier to understand. For example maybe %SourceFile%, %DestFolder%, or %Filename% instead of %T3% and %T4% in addition to %nPos%. %Input%, and %Output%.

 

Edited by Samrae
Added #4
Link to comment
Share on other sites

Hi Terrypin,

 

Thanks for your reply.

 

Maybe  this will help.

 

I will copy the path and filename/s to be copied to the clipboard.

 

Then the proposed macro will pick this value up and then ask me where I want the file to be copied too

 

Once I select the folder the macro will copy the file to that Folder

 

This is the basics of the macro.

 

Hope this helps

Link to comment
Share on other sites

 

Script:

// BEFORE RUNNING: Read the opening comment lines to ensure I've interpreted your requirement accurately.
// BEFORE RUNNING: Assign the required variables. (Quickest method is to open each command by double clicking it and respond Yes to the program's requests.)
 
// I've used longish delays to be on the safe side.
// I've used meaningful variable names as @samrae advised you. I prefix them to indicate their type, avoiding ambiguity in complex macros.
 
// STARTING STATE BEFORE MACRO IS ACTIVATED
A single file is selected in an active (focused) File Explorer folder.
// PURPOSE OF MACRO
Copy the seleced file to another existing user-selectable folder.
 
Clipboard Empty
Text Type (Simulate Keystrokes): <F2> // Edit mode.
Delay: 0.2 seconds
// Select all. (Iincluding extension, which I found necessary in Win 10.) Or use @acantor's equally effective method.
Text Type (Simulate Keystrokes): <CONTROL>a
Delay: 0.2 seconds
Clipboard Copy
Delay: 0.2 seconds
Variable Set String %tFilename% from the clipboard contents
Text Type (Simulate Keystrokes): <ESC> // Close edit mode
Delay: 0.1 seconds
// Select address of current folder.
Text Type (Simulate Keystrokes): <ALT>d
Delay: 0.1 seconds
Clipboard Copy
Delay: 0.1 seconds
 
Variable Set String %tFolder% from the clipboard contents
Text Type (Simulate Keystrokes): <ESC> // Close edit mode
Delay: 0.1 seconds
// Now re-assemble the original full filename and path.
Variable Modify String %tFullFilename%: Append Text String Variable (%tFolder%)
Variable Modify String %tFullFilename%: Append Text (\)
Variable Modify String %tFullFilename%: Append Text String Variable (%tFilename%)
Variable Modify String: Save %tFullFilename% to the clipboard
Delay: 0.1 seconds
// When testing or trouble-shooting it's helpful to show results at key stages, as in the following example. (Disable or delete this command when satisfied.)
Text Box Display: Result so far
// Now allow user to choose the destination folder.
Text Box Display: Choose destination folder
Text Type (Simulate Keystrokes): <ALT>d
Clipboard Copy
Delay: 0.1 seconds
Variable Set String %tDestination% from the clipboard contents
Text Type (Simulate Keystrokes): <ESC> // Deselect folder box
Delay: 0.2 seconds
Copy File/Files: "%tFullFilename%" to "%tDestination%"
// You could now add  commands to return focus to the original folder if you wish. Or whatever. Such ad including the above in a Repeat loop to copy a SUCCESSION of files.

 

Code:

<COMMENT Value="BEFORE RUNNING: Read the opening comment lines to ensure I've interpreted your requirement accurately." _BACK="0080FFFF"/>
<COMMENT Value="BEFORE RUNNING: Assign the required variables. (Quickest method is to open each command by double clicking it and respond Yes to the program's requests.)" _BACK="0080FFFF"/>
<COMMENT/>
<COMMENT Value="I've used longish delays to be on the safe side."/>
<COMMENT Value="I've used meaningful variable names as @samrae advised you. I prefix them to indicate their type, avoiding ambiguity in complex macros."/>
<COMMENT/>
<COMMENT Value="STARTING STATE BEFORE MACRO IS ACTIVATED\r\nA single file is selected in an active (focused) File Explorer folder."/>
<COMMENT Value="PURPOSE OF MACRO\r\nCopy the seleced file to another existing user-selectable folder."/>
<COMMENT/>
<CLIPBOARD EMPTY/>
<TEXT TYPE Action="0" Text="<F2>" _COMMENT="Edit mode."/>
<DELAY Flags="\x01" Time="0.2"/>
<COMMENT Value="Select all. (Iincluding extension, which I found necessary in Win 10.) Or use @acantor's equally effective method."/>
<TEXT TYPE Action="0" Text="<CONTROL>a"/>
<DELAY Flags="\x01" Time="0.2"/>
<CLIPBOARD COPY/>
<DELAY Flags="\x01" Time="0.2"/>
<VARIABLE SET STRING Option="\x02" Destination="%tFilename%" NoEmbeddedVars="FALSE"/>
<TEXT TYPE Action="0" Text="<ESC>" _COMMENT="Close edit mode"/>
<DELAY Flags="\x01" Time="0.1"/>
<COMMENT Value="Select address of current folder."/>
<TEXT TYPE Action="0" Text="<ALT>d"/>
<DELAY Flags="\x01" Time="0.1"/>
<CLIPBOARD COPY/>
<DELAY Flags="\x01" Time="0.1"/>
<COMMENT/>
<VARIABLE SET STRING Option="\x02" Destination="%tFolder%" NoEmbeddedVars="FALSE"/>
<TEXT TYPE Action="0" Text="<ESC>" _COMMENT="Close edit mode"/>
<DELAY Flags="\x01" Time="0.1"/>
<COMMENT Value="Now re-assemble the original full filename and path."/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%tFullFilename%" Variable="%tFolder%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x06" Destination="%tFullFilename%" Value="\\" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%tFullFilename%" Variable="%tFilename%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x10" Destination="%tFullFilename%" NoEmbeddedVars="FALSE"/>
<DELAY Flags="\x01" Time="0.1"/>
<COMMENT Value="When testing or trouble-shooting it's helpful to show results at key stages, as in the following example. (Disable or delete this command when satisfied.)"/>
<TEXT BOX DISPLAY Title="Result so far" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 tFilename = %tFilename%\r\n\\par \r\n\\par tFullFilename = %tFullFilename%\r\n\\par \r\n\\par \\f1 tFolder\\f0  = \\f1 %tFolder%\r\n\\par \r\n\\par }\r\n" Left="541" Top="485" Width="638" Height="188" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
<COMMENT Value="Now allow user to choose the destination folder."/>
<TEXT BOX DISPLAY Title="Choose destination folder" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red255\\green0\\blue0;}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 Navigate to your destination folder by whatever means you prer and leave it active.\r\n\\par \r\n\\par \\cf1 Then\\cf0  click OK to close this message and continue.\\f1 \r\n\\par }\r\n" Left="677" Top="776" Width="435" Height="171" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<TEXT TYPE Action="0" Text="<ALT>d"/>
<CLIPBOARD COPY/>
<DELAY Flags="\x01" Time="0.1"/>
<VARIABLE SET STRING Option="\x02" Destination="%tDestination%" NoEmbeddedVars="FALSE"/>
<TEXT TYPE Action="0" Text="<ESC>" _COMMENT="Deselect folder box"/>
<DELAY Flags="\x01" Time="0.2"/>
<COPY FILE/FILES Source="%tFullFilename%" Dest="%tDestination%" Progress="FALSE" Recurse="FALSE"/>
<COMMENT Value="You could now add  commands to return focus to the original folder if you wish. Or whatever. Such ad including the above in a Repeat loop to copy a SUCCESSION of files."/>

 

Exported macro: Attached.

 

Terry

 

 

CopySelectedFileToAnotherFolder.mex

Link to comment
Share on other sites

Hi Terrypin,

 

Thanks for all your time.

 

I have run your script and it appears to have an issue in these lines.

 

Text Type (Simulate Keystrokes): <ALT>d

Clipboard Copy
 

When I debug it %Destination% has  the Value  "Name Value" in it.

 

What's very strange is that when I perform the task manually it copies the correct folder path to the clipboard

 

C:\Desmond Music\New Music Library 2018\Jazz

 

See debug info below

 

 

Debug.JPG.151617d2fb25229b8653c950dc1204ed.JPG

 

 

 

Link to comment
Share on other sites

Did you run my macro or your version of it?

 

For example,  mine has a delay between the two lines you’ve shown:

Text Type (Simulate Keystrokes): <ALT>d

Clipboard Copy

 

If you don’t succeed in getting it working, in your next post show us all your script and code.

 

 

Link to comment
Share on other sites

On 10/18/2019 at 7:56 PM, terrypin said:

Did you run my macro or your version of it?

 

For example,  mine has a delay between the two lines you’ve shown:

Text Type (Simulate Keystrokes): <ALT>d

Clipboard Copy

 

If you don’t succeed in getting it working, in your next post show us all your script and code.

 

 

Hi terrypin,

 

Sorry I missed this post.

Yes I got the script working and growing in experience with the language.

 

Thanks again for all your help

Link to comment
Share on other sites

On 10/17/2019 at 11:05 AM, terrypin said:

 

Script:


// BEFORE RUNNING: Read the opening comment lines to ensure I've interpreted your requirement accurately.
// BEFORE RUNNING: Assign the required variables. (Quickest method is to open each command by double clicking it and respond Yes to the program's requests.)
 
// I've used longish delays to be on the safe side.
// I've used meaningful variable names as @samrae advised you. I prefix them to indicate their type, avoiding ambiguity in complex macros.
 
// STARTING STATE BEFORE MACRO IS ACTIVATED
A single file is selected in an active (focused) File Explorer folder.
// PURPOSE OF MACRO
Copy the seleced file to another existing user-selectable folder.
 
Clipboard Empty
Text Type (Simulate Keystrokes): <F2> // Edit mode.
Delay: 0.2 seconds
// Select all. (Iincluding extension, which I found necessary in Win 10.) Or use @acantor's equally effective method.
Text Type (Simulate Keystrokes): <CONTROL>a
Delay: 0.2 seconds
Clipboard Copy
Delay: 0.2 seconds
Variable Set String %tFilename% from the clipboard contents
Text Type (Simulate Keystrokes): <ESC> // Close edit mode
Delay: 0.1 seconds
// Select address of current folder.
Text Type (Simulate Keystrokes): <ALT>d
Delay: 0.1 seconds
Clipboard Copy
Delay: 0.1 seconds
 
Variable Set String %tFolder% from the clipboard contents
Text Type (Simulate Keystrokes): <ESC> // Close edit mode
Delay: 0.1 seconds
// Now re-assemble the original full filename and path.
Variable Modify String %tFullFilename%: Append Text String Variable (%tFolder%)
Variable Modify String %tFullFilename%: Append Text (\)
Variable Modify String %tFullFilename%: Append Text String Variable (%tFilename%)
Variable Modify String: Save %tFullFilename% to the clipboard
Delay: 0.1 seconds
// When testing or trouble-shooting it's helpful to show results at key stages, as in the following example. (Disable or delete this command when satisfied.)
Text Box Display: Result so far
// Now allow user to choose the destination folder.
Text Box Display: Choose destination folder
Text Type (Simulate Keystrokes): <ALT>d
Clipboard Copy
Delay: 0.1 seconds
Variable Set String %tDestination% from the clipboard contents
Text Type (Simulate Keystrokes): <ESC> // Deselect folder box
Delay: 0.2 seconds
Copy File/Files: "%tFullFilename%" to "%tDestination%"
// You could now add  commands to return focus to the original folder if you wish. Or whatever. Such ad including the above in a Repeat loop to copy a SUCCESSION of files.

 

Code:


<COMMENT Value="BEFORE RUNNING: Read the opening comment lines to ensure I've interpreted your requirement accurately." _BACK="0080FFFF"/>
<COMMENT Value="BEFORE RUNNING: Assign the required variables. (Quickest method is to open each command by double clicking it and respond Yes to the program's requests.)" _BACK="0080FFFF"/>
<COMMENT/>
<COMMENT Value="I've used longish delays to be on the safe side."/>
<COMMENT Value="I've used meaningful variable names as @samrae advised you. I prefix them to indicate their type, avoiding ambiguity in complex macros."/>
<COMMENT/>
<COMMENT Value="STARTING STATE BEFORE MACRO IS ACTIVATED\r\nA single file is selected in an active (focused) File Explorer folder."/>
<COMMENT Value="PURPOSE OF MACRO\r\nCopy the seleced file to another existing user-selectable folder."/>
<COMMENT/>
<CLIPBOARD EMPTY/>
<TEXT TYPE Action="0" Text="<F2>" _COMMENT="Edit mode."/>
<DELAY Flags="\x01" Time="0.2"/>
<COMMENT Value="Select all. (Iincluding extension, which I found necessary in Win 10.) Or use @acantor's equally effective method."/>
<TEXT TYPE Action="0" Text="<CONTROL>a"/>
<DELAY Flags="\x01" Time="0.2"/>
<CLIPBOARD COPY/>
<DELAY Flags="\x01" Time="0.2"/>
<VARIABLE SET STRING Option="\x02" Destination="%tFilename%" NoEmbeddedVars="FALSE"/>
<TEXT TYPE Action="0" Text="<ESC>" _COMMENT="Close edit mode"/>
<DELAY Flags="\x01" Time="0.1"/>
<COMMENT Value="Select address of current folder."/>
<TEXT TYPE Action="0" Text="<ALT>d"/>
<DELAY Flags="\x01" Time="0.1"/>
<CLIPBOARD COPY/>
<DELAY Flags="\x01" Time="0.1"/>
<COMMENT/>
<VARIABLE SET STRING Option="\x02" Destination="%tFolder%" NoEmbeddedVars="FALSE"/>
<TEXT TYPE Action="0" Text="<ESC>" _COMMENT="Close edit mode"/>
<DELAY Flags="\x01" Time="0.1"/>
<COMMENT Value="Now re-assemble the original full filename and path."/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%tFullFilename%" Variable="%tFolder%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x06" Destination="%tFullFilename%" Value="\\" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%tFullFilename%" Variable="%tFilename%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x10" Destination="%tFullFilename%" NoEmbeddedVars="FALSE"/>
<DELAY Flags="\x01" Time="0.1"/>
<COMMENT Value="When testing or trouble-shooting it's helpful to show results at key stages, as in the following example. (Disable or delete this command when satisfied.)"/>
<TEXT BOX DISPLAY Title="Result so far" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 tFilename = %tFilename%\r\n\\par \r\n\\par tFullFilename = %tFullFilename%\r\n\\par \r\n\\par \\f1 tFolder\\f0  = \\f1 %tFolder%\r\n\\par \r\n\\par }\r\n" Left="541" Top="485" Width="638" Height="188" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
<COMMENT Value="Now allow user to choose the destination folder."/>
<TEXT BOX DISPLAY Title="Choose destination folder" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red255\\green0\\blue0;}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 Navigate to your destination folder by whatever means you prer and leave it active.\r\n\\par \r\n\\par \\cf1 Then\\cf0  click OK to close this message and continue.\\f1 \r\n\\par }\r\n" Left="677" Top="776" Width="435" Height="171" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<TEXT TYPE Action="0" Text="<ALT>d"/>
<CLIPBOARD COPY/>
<DELAY Flags="\x01" Time="0.1"/>
<VARIABLE SET STRING Option="\x02" Destination="%tDestination%" NoEmbeddedVars="FALSE"/>
<TEXT TYPE Action="0" Text="<ESC>" _COMMENT="Deselect folder box"/>
<DELAY Flags="\x01" Time="0.2"/>
<COPY FILE/FILES Source="%tFullFilename%" Dest="%tDestination%" Progress="FALSE" Recurse="FALSE"/>
<COMMENT Value="You could now add  commands to return focus to the original folder if you wish. Or whatever. Such ad including the above in a Repeat loop to copy a SUCCESSION of files."/>

 

Exported macro: Attached.

 

Terry

 

 

CopySelectedFileToAnotherFolder.mex 4.9 kB · 1 download

Hi Terry,

 

Thanks to your help I have now got everything working perfectly.

 

Currently the macro only works for a single item. Could it be amended to also work if multiple files are selected?

 

Regards

 

Desmond

Link to comment
Share on other sites

Thanks Terrypin,

 

Sorry to be a pain.

 

How would the Repeat and End Repeat loop be controlled i.e how would it know how many items have been copied to the clipboard.

 

Say 3 items in Windows File Explorer has been selected do I need to use something like  Clipboard Append Text then loop the code to read each line in the file.

 

Is this the right approach?

Link to comment
Share on other sites

First, have you studied the Help and experimented with successive selections?

 

I still don’t really understand what your overall objective is? Why do you need a macro to move a selection of files to a different folder? Can’t you do it within File Explorer?

 

And if you’re selecting from multiple folders then surely that’s the most time consuming part of the task anyway, I.e. finding and selecting each one? With the file selected just activate your macro with a click or a hot key and then proceed to find the next target.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...