I have a text file with say 100 lines of text.
I'd like to be able to select 100 rows and execute a script that would populate the comments column with the contents of the text file, one line of text for each comment. I couldn't find any examples of how to do this.
Need to populate selected comments with contents of a text file
-
mrbosco
- Posts: 141
- Joined: 03 Sep 2011 09:40
-
highend
- Posts: 14926
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Need to populate selected comments with contents of a text file
readfile
init $i to 1
foreach loop over <get selecteditemspathnames>
gettoken with $i on the content of the readfile populated variable
check if it is not empty and if true: tagitems on that item
inc $i by 1
init $i to 1
foreach loop over <get selecteditemspathnames>
gettoken with $i on the content of the readfile populated variable
check if it is not empty and if true: tagitems on that item
inc $i by 1
One of my scripts helped you out? Please donate via Paypal
-
mrbosco
- Posts: 141
- Joined: 03 Sep 2011 09:40
Re: Need to populate selected comments with contents of a text file
I'm a novice to scripting.
Can you show me how it's done?
Can you show me how it's done?
-
mrbosco
- Posts: 141
- Joined: 03 Sep 2011 09:40
Re: Need to populate selected comments with contents of a text file
I think I got it.
Does this look right?
$i=1;
$INPUT=readfile("c:\test\Comment.txt");
foreach($item, <get SelectedItemsPathNames |>, , "e") {
tag gettoken($INPUT,$i,"<crlf>"), $item, 2, 1;
$i++;
}
Does this look right?
$i=1;
$INPUT=readfile("c:\test\Comment.txt");
foreach($item, <get SelectedItemsPathNames |>, , "e") {
tag gettoken($INPUT,$i,"<crlf>"), $item, 2, 1;
$i++;
}
-
highend
- Posts: 14926
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Need to populate selected comments with contents of a text file
It should work. But again, I'd test if the gettoken contains something before I (unnecessarily) tag items...
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club