Copy folder to next tab, assign label and copy path

Discuss and share scripts and script files...
Post Reply
karm
Posts: 5
Joined: 18 May 2012 12:14

Copy folder to next tab, assign label and copy path

Post by karm »

Hello,

I'm looking for a script which could copy the folder i selected in pane A, paste it in the current tab of pane B, assign label 1 to the folder of pane A, move it to a specific folder, copy to clipboard the path of the folder of pane B, and then close the tab of pane B.

Is that possible? :)

Thanks a lot and have a nice day !

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Copy folder to next tab, assign label and copy path

Post by highend »

Code: Select all

	$specialFolder = "D:\Temp\Backup";

	$sFolder = "<curitem>";
	focus "PI";
	$dFolder = tab("get", "path");
	setting('BackgroundFileOps', 0);
	copyto $dFolder, $sFolder;
	tag 3, $sFolder;
	moveto $specialFolder, $sFolder;
	copytext $dFolder;
	tab("close");
Edit the $specialFolder variable and the tag 3 command (to fit your label color).
One of my scripts helped you out? Please donate via Paypal

karm
Posts: 5
Joined: 18 May 2012 12:14

Re: Copy folder to next tab, assign label and copy path

Post by karm »

wowwww !!! You're a genius !

Thanks a lot, almost wonderful !

The only thing missing is that when it copies the path, it copies only the parent path.
Example: c:/data/
instead of: c:/data/copied folder

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Copy folder to next tab, assign label and copy path

Post by highend »

I guess you mean the "copy to clipboard" part?

This should fix it:

Code: Select all

	$specialFolder = "D:\Temp\Backup";

	$sFolder = "<curitem>";
	$sFolderBase = gettoken($sFolder, -1, "\");
	focus "PI";
	$dFolder = tab("get", "path");
	setting('BackgroundFileOps', 0);
	copyto $dFolder, $sFolder;
	tag 3, $sFolder;
	moveto $specialFolder, $sFolder;
	copytext $dFolder . "\" . $sFolderBase;
	tab("close");
One of my scripts helped you out? Please donate via Paypal

karm
Posts: 5
Joined: 18 May 2012 12:14

Re: Copy folder to next tab, assign label and copy path

Post by karm »

Thanks i was trying something else but was stuck with that syntax:

Code: Select all

 . "\" . 
i was trying with that:

Code: Select all

   $specialFolder = "D:\Temp\Backup"";

   $sFolder = "<curitem>";
   $nFolder = "<curname>";
   focus "PI";
   $dFolder = tab("get", "path");
   setting('BackgroundFileOps', 0);
   copyto $dFolder, $sFolder;
   tag 4, $sFolder;
   moveto $specialFolder, $sFolder;
   copytext $dFolder . "\" . $nFolder;
   tab("close");
Thanks a lot for your help, you learned me something very usefull today !

karm
Posts: 5
Joined: 18 May 2012 12:14

Re: Copy folder to next tab, assign label and copy path

Post by karm »

to perfect the script do you know how to do that for all selected items? not only the first?

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Copy folder to next tab, assign label and copy path

Post by highend »

Code: Select all

	$specialFolder = "D:\Temp\Backup";

	$sItems = get("SelectedItemsPathNames", "|");
	$sFolderBase = gettoken("<curpath>", -1, "\");
	focus "PI";
	$dFolder = tab("get", "path");

	setting('BackgroundFileOps', 0);
	$clipboardFolders = "";
	foreach($item, $sItems, "|") {
		if(exists($item) == 2) {
			$folderBaseName = gettoken($item, -1, "\");
			$cpEntry = $dFolder . "\" . $folderBaseName;
		} else {
			$cpEntry = $dFolder;
		}
		if(strpos($clipboardFolders, $cpEntry) == -1) {
			$clipboardFolders = $clipboardFolders . $cpEntry . <crlf>;
		}
		copyto $dFolder, $item;
		tag 4, $item;
		moveto $specialFolder, $item;
	}
	copytext $clipboardFolders;
	tab("close");
One of my scripts helped you out? Please donate via Paypal

karm
Posts: 5
Joined: 18 May 2012 12:14

Re: Copy folder to next tab, assign label and copy path

Post by karm »

Works perfectly thanks a lot !

Post Reply