Page 1 of 2

[SOLVED] Color filter by custom columns -- is this possible?

Posted: 04 Mar 2019 03:23
by sj515064
I have a custom column named "SVN status", which shows enumerations like "normal", "modified", "added", ..., etc. for each file.

I would like to have different colors for files with different values in the custom column "SVN status". For example, if a file is "modified", it is red. If it is "normal", it is green.

Is this possible?

Re: Color filter by custom columns -- is this possible?

Posted: 04 Mar 2019 04:06
by highend
Only if the entries in the custom column are representing tags.

Re: Color filter by custom columns -- is this possible?

Posted: 04 Mar 2019 06:24
by sj515064
highend wrote: ↑04 Mar 2019 04:06 Only if the entries in the custom column are representing tags.
I see. Thanks :)

Off the topic: I found the return of SC "runret()" different from the one returned directly by CMD, especially when the return is multi-line. Possibly a bug there?

Re: Color filter by custom columns -- is this possible?

Posted: 04 Mar 2019 06:26
by highend
I found the return of SC "runret()" different from the one returned directly by CMD, especially when the return is multi-line
Be more specific?

Re: Color filter by custom columns -- is this possible?

Posted: 04 Mar 2019 06:56
by sj515064
highend wrote: ↑04 Mar 2019 06:26
I found the return of SC "runret()" different from the one returned directly by CMD, especially when the return is multi-line
Be more specific?
It's difficult for you to reproduce the result :) However, returns by "runret()" and CMD are really different.
I have attached the results below. Using a tool for text comparison it's easy to see the difference:

https://sjtueducn-my.sharepoint.com/:u: ... A?e=aznog1

This occurs mostly when there are CJK characters and multiple lines in the return.

Re: Color filter by custom columns -- is this possible?

Posted: 04 Mar 2019 07:04
by highend
And the runret() part of the script looks like?...

Re: Color filter by custom columns -- is this possible?

Posted: 04 Mar 2019 07:07
by sj515064
highend wrote: ↑04 Mar 2019 07:04 And the runret() part of the script looks like?...
It's like this:

Code: Select all

$P_SVN_Result = runret("svn status -v");
          //for debug
          writefile("return_by_runret.txt", $P_SVN_Result);

Re: Color filter by custom columns -- is this possible?

Posted: 08 Mar 2019 12:09
by sj515064
Just for reference for those who also come across the problem (return by runret() is not the same as that of CMD):

Root of the problem is difficult to locate. However, I did find a workaround:
1. Replace

Code: Select all

runret(command);
with

Code: Select all

run "cmd /c command ""<curpath>"" > ""<xydata>\temp\output.txt""", ,2,0;
(if "<curpath>" is not necessary simply remove it)
2. Read the output.txt in the temp folder:

Code: Select all

$Result = readfile("<xydata>\temp\output.txt");
3. Use $Result as you wish.

Re: Color filter by custom columns -- is this possible?

Posted: 08 Mar 2019 12:16
by highend
run "cmd /c command ""<curpath>"" > <xydata>\temp\output.txt", ,2,0;
You'll get into trouble if <xydata> is a path that contains a space!

Re: Color filter by custom columns -- is this possible?

Posted: 08 Mar 2019 12:35
by sj515064
highend wrote: ↑08 Mar 2019 12:16 run "cmd /c command ""<curpath>"" > <xydata>\temp\output.txt", ,2,0;
You'll get into trouble if <xydata> is a path that contains a space!
Thanks for the alert :)

I'm a newbie in XY scripting. I think adding or removing some quotation marks will help to avoid the problem.
But I don't know how to do it :?:

Re: Color filter by custom columns -- is this possible?

Posted: 08 Mar 2019 12:37
by highend
And looking at how it is done for <curpath> does not help? oO

Re: Color filter by custom columns -- is this possible?

Posted: 08 Mar 2019 12:50
by sj515064
highend wrote: ↑08 Mar 2019 12:37 And looking at how it is done for <curpath> does not help? oO
I remember it now :) -- Paths with whitespace should be quoted, like this "PATH".

The post has been updated.

Re: Color filter by custom columns -- is this possible?

Posted: 08 Mar 2019 13:22
by highend
You need to quote the full path, not only a part of it...

Re: Color filter by custom columns -- is this possible?

Posted: 08 Mar 2019 13:30
by sj515064
highend wrote: ↑08 Mar 2019 13:22 You need to quote the full path, not only a part of it...

I finally figure it out:

It should be

Code: Select all

run "cmd /c command ""<curpath>"" > ""<xydata>\temp\output.txt", ,2,0;
rather than

Code: Select all

run "cmd /c command ""<curpath>"" > ""<xydata>""\temp\output.txt", ,2,0;
Thanks for the correction (again) :)

Re: Color filter by custom columns -- is this possible?

Posted: 08 Mar 2019 13:35
by highend
run "cmd /c command ""<curpath>"" > ""<xydata>\temp\output.txt""", ,2,0;