r/dailyscripts • u/AxeEnding999 • Mar 06 '17
[Request] [Windows 10] Script which would put text onto tables
Hi. I'm looking for some help on creating a type of script which would paste text onto a code which creates a table
Code: http://pastebin.com/vBckRVeS
For example, I would want to put these scripts:
Apple634 Blueberry81 Plum099
where the Orange# were in the original code, so it looks like this:
Any information would be appreciated
1
Upvotes
View all comments
Show parent comment
1
u/RulerOf Mar 07 '17 edited Mar 07 '17
For the sake of my directions, rename your list file to
filenames.txtand put it on your desktop.First, do a Find and Replace (Ctrl+H) to remove the .ogg extension from all the lines in the
filenames.txtfile. And then save it.Assuming that
filenames.txtandtemplate.txtare on your desktop, copy and paste this into powershell: http://pastebin.com/ihrDRkb9Once you run it, you should get a file called
output.txton your desktop with the results in it.If you have to run the script more than once, you'll want to delete
output.txtinbetween runs, because it'll just keep tacking stuff onto the end of that file.For some explanation, here's what's going on in the script:
$filenames = Get-Content ~\Desktop\filenames.txt$template = Get-Content ~\Desktop\template.txtForEach ($name in $filenames){ $template -replace ("%%%", $name) | Out-File -Append ~\Desktop\output.txt }%%%, and replace it with the current value of the $name variable.