i set "extra2" column : datatype as "txt" ,label is "name"
i have csv file like this (first column is file path,second column is "name" tag i want to set to "extra2" column
(i can change the csv format to text format and change the separator to something easier to separate such as "****" instead of "space" character)
E:\female\2015_1231_00_50_13_354.png Ana
E:\female\2016_0102_16_33_22_124.png Jamie
E:\female\2016_0103_00_58_57_317.png Irina
E:\female\2016_0105_21_12_17_466.png Hanna V2.4
E:\female\2016_0106_06_16_11_884.png Minami
For more clearly, i want to set
"Ana" extra2 tag to file "E:\female\2015_1231_00_50_13_354.png"
"Jamie" "E:\female\2016_0102_16_33_22_124.png"
and so on ...
is it possible to set "extra2" automatically with input data like this ? (for example ,by scripting ...)
Thanks in advance
[solved] Set "extra2" tag with input data
-
xnmp
- Posts: 88
- Joined: 15 Mar 2013 04:46
[solved] Set "extra2" tag with input data
Last edited by xnmp on 15 Oct 2016 14:41, edited 1 time in total.
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: [help] Set "extra2" tag with input data
So to get it straight:
You have one file which contains "associations": file + name, delimited via a space
and you want a column to display the name for each file
extra2 column:
Con: Requires you to manually update the tag.dat
database every time your file (that contains the associations) changes.
Pro: Fast, the columns are populated via the tag.dat db
A normal custom column:
Con: Slow, for each displayed entry in the file list, the "csv" file needs to be parsed again
Pro: Always up to date for each file without "manually" updating the tag.dat database
So what do you prefer?
You have one file which contains "associations": file + name, delimited via a space
and you want a column to display the name for each file
extra2 column:
Con: Requires you to manually update the tag.dat
database every time your file (that contains the associations) changes.
Pro: Fast, the columns are populated via the tag.dat db
A normal custom column:
Con: Slow, for each displayed entry in the file list, the "csv" file needs to be parsed again
Pro: Always up to date for each file without "manually" updating the tag.dat database
So what do you prefer?
One of my scripts helped you out? Please donate via Paypal
-
xnmp
- Posts: 88
- Joined: 15 Mar 2013 04:46
Re: [help] Set "extra2" tag with input data
Thank you very much for the very detailed information (and for your enthusiasm)highend wrote:So to get it straight:
So what do you prefer?
i understand what you wrote clearly
The method i need is the first method (use "extra2" column) , i really appreciate if you could help me to do this method
(i use the csv to set "extra2" tag for multiple file - only once
then if i want to update the "extra2" column, i will do it through xyplorer by the script that you wrote for me viewtopic.php?f=3&t=16212 instead of update the csv file)
Last edited by xnmp on 15 Oct 2016 09:08, edited 2 times in total.
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: [help] Set "extra2" tag with input data
Code: Select all
$file = "R:\Associations.csv";
$content = readfile($file);
foreach($entry, $content, <crlf>, "e") {
tagitems("ex2", gettoken($entry, 2), gettoken($entry, 1));
}
savesettings 64;
One of my scripts helped you out? Please donate via Paypal
-
xnmp
- Posts: 88
- Joined: 15 Mar 2013 04:46
Re: [help] Set "extra2" tag with input data
Thank you very much ,highend ,you made my dayhighend wrote:Just change the $file variable to point to your local .csv file that contains the associations...Code: Select all
$file = "R:\Associations.csv"; $content = readfile($file); foreach($entry, $content, <crlf>, "e") { tagitems("ex2", gettoken($entry, 2), gettoken($entry, 1)); } savesettings 64;
i 'll try it
-
xnmp
- Posts: 88
- Joined: 15 Mar 2013 04:46
Re: [help] Set "extra2" tag with input data
Hi again,Highend. Thank you so much for the helpshighend wrote:Just change the $file variable to point to your local .csv file that contains the associations...Code: Select all
$file = "R:\Associations.csv"; $content = readfile($file); foreach($entry, $content, <crlf>, "e") { tagitems("ex2", gettoken($entry, 2), gettoken($entry, 1)); } savesettings 64;
it does not work for me ,i think it because of the separator of my csv file is not the same as i described before
(i'm sorry for that)
When i open the csv with notepad++, it looks like this (separator is comma "," character ) and the filepath also contains "space" character
(i said "space" character before because when i paste the content from csv to notepad++ it become "space" character)E:\Program Files\female\2015_1002_23_48_40_653.png,Scarlett
E:\Program Files\female\2015_1010_11_17_15_151.png,Oichi
However, because the name and the filepath may contain comma "," character ,i want to change the separator of the script from
<crlf> to special character such as "*" or something ,
so i want to ask if i can change my suggestion/request like this
New Suggestion
1. input file is txt file (simple format)
2. the separator now is * character (for not duplicated with characters of filepath and name)
The new input file (txt, UTF8) will look like this :
could you please re-edit the script for the new input file ?E:\Program Files\female\2015_1002_23_48_40_653.png*Scarlett
E:\Program Files\female\2015_1010_11_17_15_151.png*Oichi
Thank you very much and sorry for the inconvenient
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: [help] Set "extra2" tag with input data
Code: Select all
tagitems("ex2", gettoken($entry, 2, "*"), gettoken($entry, 1, "*"));One of my scripts helped you out? Please donate via Paypal
-
xnmp
- Posts: 88
- Joined: 15 Mar 2013 04:46
Re: [help] Set "extra2" tag with input data
Thank you so much ,it works like a charmhighend wrote:and edit the $file to "file name.txt" instead of .csv...Code: Select all
tagitems("ex2", gettoken($entry, 2, "*"), gettoken($entry, 1, "*"));
I paste the complete version here for who needed (maybe me in the future
Code: Select all
$file = "E:\test\filepathname.txt";
$content = readfile($file,,,65001);
foreach($entry, $content, <crlf>, "e") {
tagitems("ex2", gettoken($entry, 2, "*"), gettoken($entry, 1, "*"));
}
savesettings 64;-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: [help] Set "extra2" tag with input data
readfile() works with UTF-8 / UTF-16LE (both with BOM) without the need to supply the codepage
One of my scripts helped you out? Please donate via Paypal
-
xnmp
- Posts: 88
- Joined: 15 Mar 2013 04:46
Re: [help] Set "extra2" tag with input data
Thank you for the information, i thought the old code not work with UTF8highend wrote:readfile() works with UTF-8 / UTF-16LE (both with BOM) without the need to supply the codepage
Now i see it because of my text file is encoded in UTF-8 without BOM
XYplorer Beta Club