Page 1 of 1

Copy folder to next tab, assign label and copy path

Posted: 18 May 2012 12:19
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 !

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

Posted: 18 May 2012 12:59
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).

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

Posted: 18 May 2012 14:16
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

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

Posted: 18 May 2012 14:38
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");

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

Posted: 18 May 2012 14:47
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 !

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

Posted: 23 May 2012 15:37
by karm
to perfect the script do you know how to do that for all selected items? not only the first?

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

Posted: 23 May 2012 16:45
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");

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

Posted: 24 May 2012 17:27
by karm
Works perfectly thanks a lot !