Page 1 of 1

Xplorer2's Comments

Posted: 10 Mar 2012 12:47
by armsys
Comments entered in Xplorer2 won't be shown in XYplorer. Why? Please help. Thanks.

Re: Xplorer2's Comments

Posted: 10 Mar 2012 12:50
by Marco
Probably because xplorer2 uses ntfs ADS, while XY uses its own database for tags, labels and comments.

Re: Xplorer2's Comments

Posted: 10 Mar 2012 13:03
by armsys
Marco,
Thanks for your amazingly fast reply.
Thanks for explaining the trick.
Is it possible to copy the ADS comments into XY by a script?

Re: Xplorer2's Comments

Posted: 10 Mar 2012 13:35
by Marco
Sure, as long as you can read the ADS, but I don't know of any CL utility for that atm.

Re: Xplorer2's Comments

Posted: 10 Mar 2012 14:20
by admin
armsys wrote:Comments entered in Xplorer2 won't be shown in XYplorer. Why? Please help. Thanks.
Select such a file in the file list. Then paste this into the XY address bar and press <enter>:

Code: Select all

text property("DocComments");
Do you see the comment? If yes it will be easy to write a script to generate XY comments from ADS comments.

Re: Xplorer2's Comments

Posted: 10 Mar 2012 15:14
by armsys
Yes, ::text property("DocComments"); can display the comments created by Xplorer2.
Then, how to create a script to convert all ADS comments into XYplorer?

Re: Xplorer2's Comments

Posted: 10 Mar 2012 17:55
by admin
armsys wrote:Yes, ::text property("DocComments"); can display the comments created by Xplorer2.
Then, how to create a script to convert all ADS comments into XYplorer?
I hope some of the script cracks helps you on. I have no time today for it, sorry.

Re: Xplorer2's Comments

Posted: 12 Mar 2012 12:17
by TheQwerty
I didn't have the time to really test this but it should prepend the DocComments to XY's comments. If there are selected items it will act only on them, otherwise it will act on all items displayed in the active list pane.

Code: Select all

"Store DocComments in XY"
	// If no selection act on the items displayed in the active pane.
	$list = Report('{FullName}|', Get('CountSelected') > 0);
	
	// Clean up the list a little.
	$list = FormatList($list, 'ted');

	$dirty = false;
	
	// For every item
	foreach ($item, $list) {
		// Retrieve DocComments.
		$docComment = Property('DocComments', $item);
		if ($docComment UnLikeI '') {
			// Retrieve existing XY comments.
			$comment = Property('#Comment', $item);
			
			if ($comment UnLikeI $docComment) {
				if ($comment UnLikeI '') {
					// Prepend DocComments to XY comments
					$docComment = "$docComment<crlf>$comment";
				}
				
				// Store new comment
				Tag "$docComment", $item, 2, 0;
				$dirty = true;			
			}
		}
	}

	if ($dirty) {
		#195; // File | Settings | Save Tags
	}
If you're like this :shock: and not quite sure where to put a script I suggest taking a 10-minute break and reading this: http://www.xyplorer.com/xyfc/viewtopic. ... 748#p53748

Re: Xplorer2's Comments

Posted: 12 Mar 2012 12:30
by armsys
Hi TheQwerty,
Thanks for your fast and thorough help.

Re: Xplorer2's Comments

Posted: 13 Apr 2020 13:20
by jonhyq
TheQwerty wrote: ↑12 Mar 2012 12:17 I didn't have the time to really test this but it should prepend the DocComments to XY's comments. If there are selected items it will act only on them, otherwise it will act on all items displayed in the active list pane.

Code: Select all

"Store DocComments in XY"
	// If no selection act on the items displayed in the active pane.
	$list = Report('{FullName}|', Get('CountSelected') > 0);
	
	// Clean up the list a little.
	$list = FormatList($list, 'ted');

	$dirty = false;
	
	// For every item
	foreach ($item, $list) {
		// Retrieve DocComments.
		$docComment = Property('DocComments', $item);
		if ($docComment UnLikeI '') {
			// Retrieve existing XY comments.
			$comment = Property('#Comment', $item);
			
			if ($comment UnLikeI $docComment) {
				if ($comment UnLikeI '') {
					// Prepend DocComments to XY comments
					$docComment = "$docComment<crlf>$comment";
				}
				
				// Store new comment
				Tag "$docComment", $item, 2, 0;
				$dirty = true;			
			}
		}
	}

	if ($dirty) {
		#195; // File | Settings | Save Tags
	}
If you're like this :shock: and not quite sure where to put a script I suggest taking a 10-minute break and reading this: http://www.xyplorer.com/xyfc/viewtopic. ... 748#p53748
Can someone please adapt the aforementioned code, so that the Comments on the file (xplorer2) are imported as Labels in XYplorer? The code above works but it imports them as Comments in XYplorer, and in my case I would like them to imported as Labels (essentially my comments in xplorer are used for folder coloring and that is why they must imported as Labels).

I am considering to make the jump to XYplorer but this holds me back, I don't want to lose all my file tags.

Thank you in advance

Re: Xplorer2's Comments

Posted: 13 Apr 2020 14:42
by highend
Completely untested (but if it works it's rather fast because of only tagging once, not every single file one at a time)...

Code: Select all

"Store DocComments in XY"
    // Choose your label color!
    // Available by default: Red;Orange;Yellow;Green;Blue;Purple;Grey
    $labelColor = "red";

    // If no selection act on the items displayed in the active pane.
    $list = Report('{FullName}|', Get('CountSelected') > 0);

    // Clean up the list a little.
    $list = formatlist($list, 'ted');

    // For every item
    $itemsToTag = "";
    foreach ($item, $list) {
        if (property('DocComments', $item) != '') {
            $itemsToTag .= $item . "|";
        }
    }

    if ($itemsToTag) {
        tag $labelColor, trim($itemsToTag, "|", "R");
        #195; // File | Settings | Save Tags
    }

Re: Xplorer2's Comments

Posted: 13 Apr 2020 21:19
by jonhyq
Thank you highend for your help. Although your code did not work (it was applying to all files the same Label defined), it proved to be very helpful. Based on that I was able to modify it and have the functionality as I wanted. I put it below, since it might be helpful to others. The code deals with 3 defined colors, if someone needs more, all he needs to do is copy the relevant sections more times, it's easy to see the pattern.

Code: Select all

"Store DocComments in XY"
    // Choose your label color!
    // Available by default: Red;Orange;Yellow;Green;Blue;Purple;Grey
    $labelColor1 = "Red"; 
    $labelColor2 = "Yellow";
    $labelColor3 = "Green"; 

    // If no selection act on the items displayed in the active pane.
    $list = Report('{FullName}|', Get('CountSelected') > 0);

    // Clean up the list a little.
    $list = formatlist($list, 'ted');

    // For every item
    $itemsToTag1 = "";
    $itemsToTag2 = "";
    $itemsToTag3 = "";

    foreach ($item, $list) {
       $labelColor = Property('DocComments', $item);
        if  $labelColor == $labelColor1 {
            $itemsToTag1 .= $item . "|";
        }

        if $labelColor == $labelColor2 {
            $itemsToTag2 .= $item . "|";
        }

        if $labelColor == $labelColor3 {
            $itemsToTag3 .= $item . "|";
        }
    }

    if ($itemsToTag) {
        tag $labelColor1, trim($itemsToTag1, "|", "R");
        tag $labelColor2, trim($itemsToTag2, "|", "R");
        tag $labelColor3, trim($itemsToTag3, "|", "R");
        #195; // File | Settings | Save Tags
    }
The aforementioned code should be fast as highend indicated. If it's too much hassle for someone to modify the code (or does not understand), I am also providing a modified version of the code that is fully automatic and goes each file one by one and whatever "Comment" it has, it makes it a Label for use by XYplorer. It might be more slow of course.

Code: Select all

"Store DocComments in XY"

    // If no selection act on the items displayed in the active pane.
    $list = Report('{FullName}|', Get('CountSelected') > 0);

    // Clean up the list a little.
    $list = formatlist($list, 'ted');

    // For every item
    $itemsToTag = "";
    foreach ($item, $list) {
        $labelColor = Property('DocComments', $item);
        if $labelColor != '' {
            Tag "$labelColor", $item, 0, 0;
        }
    }

    if ($itemsToTag) {
        #195; // File | Settings | Save Tags
    }