Copy/Move to: easy choose pre-defined target folders?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Ambaquista
Junior Member
Junior Member
Posts: 60
Joined: 2005-05-27, 11:11 UTC
Location: Luanda, Angola

Copy/Move to: easy choose pre-defined target folders?

Post by *Ambaquista »

The good old Firefox (pre v.:57...) has a small and very useful context extension, "Save File to":
Save File to is a small Firefox extension that helps you to save links, images and web pages to user-defined folders and their sub-folders straight from context menu without opening the save dialog.

https://bitbucket.org/atte-kemppila/save-file-to/wiki/Home
I searched a lot (including scripts Autokey, PowerPro), but didn´t see anything similar.

Will be very useful to put as a command in the "copy files" and the "rename/move files in the vertical bar.

Any idea?

Thanks
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6480
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

For me this is not a job for an file manager.
I use CintaNotes for this purpose.
It supports clipping, tags and much more.
I have the Life time Pro license but even the free version is enough for most users.
http://cintanotes.com/?utm_source=wapp&utm_medium=mm
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Re: Copy/Move to

Post by *HolgerK »

Ambaquista wrote:.., but didn´t see anything similar.
Hidden in windows explorers shell there is a very similar option for the shell context menu:
https://www.howtogeek.com/howto/windows/add-copy-to-move-to-to-the-windows-explorer-right-click-menu/

Only difference is that the destination is not selected via breadcrumb menu.
A select folder dialog is used instead (which remembers the last selected folder, and offers the option to create a new one).

Works also in Total Commander.

Regards
Holger
Make our planet great again
User avatar
Dalai
Power Member
Power Member
Posts: 9387
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

2HolgerK
Windows 7 and later have these context menu entries OOTB, but hidden by default, requiring to press Shift when right-clicking to make them visible. Adding these registry values make them visible without Shift. Apart from that, the HowTo you linked to is not so good because the pictures don't match the textual description in all cases, and the downloadable .reg files differ from both of them. However, I learned something nonetheless, because I didn't know this was already possible in XP (maybe even Win2k) :).

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Ambaquista
Junior Member
Junior Member
Posts: 60
Joined: 2005-05-27, 11:11 UTC
Location: Luanda, Angola

Post by *Ambaquista »

Thank you all, but I think I need to put more info:

1. When in the web, I download programs, pages, selections (with UnMHT), etc to the windows download folder;
2. later I need to organize and move the downloaded itens to diferent final folders - \programs archive; \ebooks, \aviation; etc

something like empower the "rename/move files" button (vertical bar), to opening a window with my archiving folders, to choose the one

thanks
User avatar
Stefan2
Power Member
Power Member
Posts: 4157
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Ambaquista wrote:...

something like empower the "rename/move files" button (vertical bar), to opening a window with my archiving folders, to choose the one
Sounds like you could use "Ctrl+D" in target panel
to open your -beforehand stored- archiving folders...?

Then go back to source panel and execute your "copy/move" command.


For "Ctrl+D" feature explanation see:
Help > 3. Operation - a. User interface > (Directory Hotlist and History)

- - -

Also you can have different tabs open in target panel and drag&drop on the tab headers.


- - -


Additionally you have the drop-down menu with recent paths in the "copy/move" command dialog.
So after you "copy/move" once to that folders, you can just choose them from the drop-down menu afterwards.




 
User avatar
Stefan2
Power Member
Power Member
Posts: 4157
Joined: 2007-09-13, 22:20 UTC
Location: Europa

VBScript: ForEachSelectedDO - ChooseTargetToCopyTo.vbs

Post by *Stefan2 »

Here is a script for you.

- save the code as text file xxx.VBS

- adjust the message text and the target paths (1=archive; 2=ebooks;...)
- - -1. Create "case"-rules for each wanted target, like case user entered a '1', target is in this example folder 'A'
..........case 1 strTarget = "X:\temp\archive"
..........case 2 strTarget = "X:\temp\ebooks\"
- - -2. Update the text in the InputBox to add explanation hints, like here " insert '1' to choose archive folder 'A' as target.
..........intUserTarget = InputBox("Choose target: 1=archive; 2=ebooks; 3=aviation

- create an TC button for that script
..........Command: "X:\path\to\ForEachSelectedDO - Kopie to Target.vbs"
..........Parameter: "%L"
..........Icon: C:\windows\System32\WScript.exe,2 <<< -or- WCMICONS.DLL >>>
..........Tooltip: ForEachSelectedDO - Kopie to Target


- select a few files and click that button
- chose the wanted path number and click OK
done?


Code: Select all

'//VBScript for TC to select Target for copy on the fly.
'
' https://ghisler.ch/board/viewtopic.php?p=338700#338700
' Version 1.1 ; 2018-03-06-0900 (added some basic error handling)
'
'//TC-Button:
'//Command: "X:\path\to\ForEachSelectedDO - Kopie to Target.vbs"
'//Parameter: "%L"
'//Icon: C:\windows\System32\WScript.exe,2
'//Tooltip: ForEachSelectedDO - Kopie to Target
'//============================================================================================
Set FSO  = CreateObject("Scripting.FileSystemObject")
Set wsArgs = WScript.Arguments
If wsArgs.count > 0 Then
	Set strTCTempFile = CreateObject("Scripting.FileSystemObject").OpenTextFile(wsArgs(0), 1)
Else
	MsgBox "Error"
	Wscript.Quit
End If

'//========== USER SETTINGS

'//InputBox(prompt[, title][, default] ,Xpos,Ypos,HelpFile location, Context in the help file) 
intUserTarget = InputBox("Choose target: 1=archive; 2=ebooks; 3=aviation; 4=TestXYZ; 5=ToDo; 6=Bla bla; 7=later; 8=nifty tricks", "TC-Script", 1)
   If (intUserTarget = "") Then WSCript.Quit



Select Case intUserTarget
	case 1 strTarget = "X:\temp\archive"
	case 2 strTarget = "X:\temp\ebooks\"
	case 3 strTarget = "X:\temp\aviation"
	'// and so on...
	'
	'
	'
	'
End Select




'//========== THE CODE
If Not FSO.FolderExists(strTarget) Then 
	MsgBox "Target not found, script quits." _
			& vbLF & vbLF & strTarget & vbLF & vbLF 
	WSCript.Quit
End If

Do While Not strTCTempFile.AtEndOfStream
    strCurrFile = strTCTempFile.ReadLine
    If Right(strCurrFile,1) <> "\" then '//no folders yet
			strNew = strTarget &"\"& FSO.GetFileName(strCurrFile)
			If Not FSO.FileExists(strNew) Then 
				'//COPY:
				'''FSO.CopyFile source, destination [,overwriteExisting? True(Default)/False]
				 FSO.CopyFile strCurrFile, strNew, False 
				'//MOVE: ; added 23.12.2019, untested:
				'''FSO.MoveFile source, destination
				'''An error also occurs if a source file doesn't exist and if the destination is a directory or an existing file.
				'FSO.MoveFile strCurrFile, strNew
			Else
			        ' //maybe ToDo: add serializing numbering if file already exists
                                 strOUT = strOUT & strCurrFile & vbCRLF
                                 strOUT = strOUT & strNew & vbCRLF
			End If
    End If
Loop

If (strOUT<>"") Then 
	strOUT = "Not copied, name already exists in target:" & vbCRLF & vbCRLF & strOUT
	MsgBox strOUT
End If
'//============================================================================================




 make sense?


Find me: chose choose target menu wähle ziel menü
User avatar
Ambaquista
Junior Member
Junior Member
Posts: 60
Joined: 2005-05-27, 11:11 UTC
Location: Luanda, Angola

Post by *Ambaquista »

To Stefan2
THANKS for your help, its just my wish, but...

I made 2 scripts CopyTo.vbs and MoveTo.vbs (here I change both "CopyFile" - lines 32 and 33 in your script with "MoveFile")

Create a button and try, with the following error message:
---------------------------
Windows Script Host
---------------------------
Script: C:\Utilities\totalcmd\plugins\scripts\CopyTo.vbs
Line: 19
Char: 133
Error: Expected ')'
Code: 800A03EE
Source: Microsoft VBScript compilation error

---------------------------
OK
---------------------------
the 19/133 position is just after the last choice (the "X" below):
... 7=later; 8=nifty tricksX", "TC-Script", 1)...
I put the ")", but... new error message:
---------------------------
Windows Script Host
---------------------------
Script: C:\Utilities\totalcmd\plugins\scripts\CopyTo.vbs
Line: 19
Char: 134
Error: Expected end of statement
Code: 800A0401
Source: Microsoft VBScript compilation error

---------------------------
OK
---------------------------
what I did wrong?

Regards
User avatar
Stefan2
Power Member
Power Member
Posts: 4157
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Ambaquista wrote:
what I did wrong?

Not showing me your whole script...




And my crystal bowl is broken :cry:





Be sure to have one long line here and correct quotes and parentheses:

intUserTarget = InputBox(   "Choose target: ....."   ,   "TC-Script"   ,   1   )

as long lines are often broken in forum software.




 
User avatar
Ambaquista
Junior Member
Junior Member
Posts: 60
Joined: 2005-05-27, 11:11 UTC
Location: Luanda, Angola

Post by *Ambaquista »

OK, sorry...
I made changes from line 24 to line 36 only


'//VBScript for TC to select Target for copy on the fly.
'
' viewtopic.php?p=338700#338700
' Version 1.1 ; 2018-03-06-0900 (added some basic error handling)
'
'//TC-Button:
'//Command: "X:\path\to\ForEachSelectedDO - Kopie to Target.vbs"
'//Parameter: "%L"
'//Icon: C:\windows\System32\WScript.exe,2
'//Tooltip: ForEachSelectedDO - Kopie to Target
'//============================================================================================
Set FSO = CreateObject("Scripting.FileSystemObject")
Set wsArgs = WScript.Arguments
If wsArgs.count > 0 Then
Set strTCTempFile = CreateObject("Scripting.FileSystemObject").OpenTextFile(wsArgs(0), 1)
Else
MsgBox "Error"
Wscript.Quit
End If

'//========== USER SETTINGS

'//InputBox(prompt[, title][, default] ,Xpos,Ypos,HelpFile location, Context in the help file)
intUserTarget = InputBox("Choose target: 1=Angola; 2=Aviation; 3=ClipArt; 4=EBooks; 5=Fonts; 6=FormProf; 7=IT; 8=Ludico; 9=Politica", "TC-Script", 1)
If (intUserTarget = "") Then WSCript.Quit

Select Case intUserTarget
case 1 strTarget = "e:\mediateca\An\"
case 2 strTarget = "e:\mediateca\AV\"
case 3 strTarget = "e:\mediateca\Clipart\"
case 4 strTarget = "e:\mediateca\Ebooks\"
case 5 strTarget = "e:\mediateca\Fonts\"
case 6 strTarget = "e:\mediateca\FP\"
case 7 strTarget = "e:\mediateca\IT\"
case 8 strTarget = "e:\mediateca\Lu\"
case 9 strTarget = "e:\mediateca\Po\"

End Select


'//========== THE CODE
If Not FSO.FolderExists(strTarget) Then
MsgBox "Target not found, script quits." _
& vbLF & vbLF & strTarget & vbLF & vbLF
WSCript.Quit
End If

Do While Not strTCTempFile.AtEndOfStream
strCurrFile = strTCTempFile.ReadLine
If Right(strCurrFile,1) <> "\" then '//no folders
strNew = strTarget &"\"& FSO.GetFileName(strCurrFile)
If Not FSO.FileExists(strNew) Then
'FSO.CopyFile source, destination [,overwriteExisting? True(Default)/False]
FSO.CopyFile strCurrFile, strNew, False
Else
strOUT = strOUT & strCurrFile & vbCRLF
End If
End If
Loop

If (strOUT<>"") Then
strOUT = "Not copied, name already exists in target:" & vbCRLF & vbCRLF & strOUT
MsgBox strOUT
End If
'//============================================================================================

Regards
User avatar
Stefan2
Power Member
Power Member
Posts: 4157
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

I see no error?

I saved your code and double click it
and get the wanted "error" message,.. > script works here.
Else I would get an 'Windows Script Host' error message like you have posted above.




Next I add it to the button bar and add "%L" as parameter,... and it works (I adjusted the target paths before)

Code: Select all

TOTALCMD#BAR#DATA
"C:\temp\TC\SelectTarget\Ambaquista.vbs"
"%L"
C:\windows\System32\WScript.exe,2
Ambaquista


-1



I will take a deeper look tomorrow.....
User avatar
Stefan2
Power Member
Power Member
Posts: 4157
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Stefan2 wrote:I will take a deeper look tomorrow.....
Nothing to do here for me, your posted script works here.
I can't imagine was has going wrong on your PC :?







 
User avatar
Ambaquista
Junior Member
Junior Member
Posts: 60
Joined: 2005-05-27, 11:11 UTC
Location: Luanda, Angola

Post by *Ambaquista »

It works!!
I forget the "%L" parameter...

Thanks!
Best regards
User avatar
Stefan2
Power Member
Power Member
Posts: 4157
Joined: 2007-09-13, 22:20 UTC
Location: Europa

UDC usercmd.ini: add a keyboard shortcut to that command

Post by *Stefan2 »

Ambaquista wrote:It works!!
Great :thumpsup:



Next you could add a keyboard shortcut to that command (if wanted/needed)




Therefor, create the button as a 'user defined command' into the usercmd.ini:

Code: Select all

* open "Configuration > Options > Misc."
* choose any key (just temporarily for creating the command, or chose one to keep)
* click on magnifying glass icon, the 'cm_commandbrowser' will be launched
-or-
* just type 'cm_commandbrowser' into the TC command line box


-next-

* choose usercmd.ini at bottom of left listview
(the usercmd.ini file will be created if not existent yet, if you add a new command using new)

* click at [New]

* enter the wanted name for your new user defined command, 
--- like for example 'em_MyCommandName' 
--- (the "em_" -part is mandatory) 
* click on OK

* type in your own command details, 
or select a command on right side via the 'magnifying glass' symbol

* click on OK twice

Next, if not already done above,:

Code: Select all

Add shortcut key to em_ or cm_ commands

Utilize "Configuration > Options > Misc." to assign the hot key.

* open "Configuration > Options > Misc."
* by "shortcuts" choose a free key combo
* click on the magnifying glass
* type em_ (or cm_) and choose the wanted command by double clicking on it
* close the options dialog with [OK]
* click on OK 



(Taken from http://ghisler.ch/board/viewtopic.php?p=291895#291895)
User avatar
Ambaquista
Junior Member
Junior Member
Posts: 60
Joined: 2005-05-27, 11:11 UTC
Location: Luanda, Angola

Post by *Ambaquista »

Thanks

I will try next weekend

Best regards
Post Reply