Automate notepad?

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
9,144
Reaction score
10,489
Lately ive been automating every little thing i can in my daily work. And now i want to automate a little something in notepad. Not notepad++, just the regular plain old windows notepad.

So i have a file with hundreds of lines that go something like this:

Something something
Bhw - 34
Bhw - 543
Bhw - 128
Bhw - 97
Bhw - 261
Bhw - 33

Something something
Bhw - 452
Bhw - 39
Bhw - 252
Bhw - 48

And on and on it goes for hundreds of lines. And i find myself adding up those numbers manually. So the second example would become:

Something something
Bhw - 791

Im looking for something i could run manually and it would just go through the entire file and add them all up. Or even better something running in the background at all times, and for example adding them up after 1 hour of inactivity, or once per day at a specific hour.

Any ideas what i can use to do this?

p.s please keep the suggestions that i should use notepad++ or word or some other program instead to yourself. Nothing is as fast and realiable as the notepad, and i dont want to have a discussion about it.

Thanks :)
 
I hear you that you don't want to use a different program, but this can easily be done in Excel or Google Sheets. Just put all your lines in there, and in a new column delimit by " - ", and you'll split the columns into "bhw" and the number. Then just sum those numbers. Again, I get that notepad is simple and reliable, but when it comes to numbers like that, it is so much easier to use a program that is literally made to do things like that.

If you need help in how to do this, I am more than happy to show you.
 
find a c# or c++ programmer or even Java , it's very easy for him to do it i believe , any beginner programmer will do it for you because the idea is simple ,
 
This can easily be done in Python. Just google some example scripts of adding up numbers in a text file.
 
please keep the suggestions that i should use notepad++ or word or some other program instead to yourself. Nothing is as fast and realiable as the notepad, and i dont want to have a discussion about it.
No offense bro but if you are not willing to learn new things you won't get any solution to your problems.
This thread is like - I want to cut down huge tree with a swiss knife. I dont want to use saw, chainsaw and I don't want discussion about it.
Your approach is just wrong. You can learn how to code or use notepad++/Excel at pro level in X hours, you can also waste 5-10 times X hours looking for solutions that cant be found in way you want them.

Lately ive been automating every little thing i can in my daily work
Trust me if you dont know how to code you didnt ever see real automation in action.
 
I hear you that you don't want to use a different program, but this can easily be done in Excel or Google Sheets. Just put all your lines in there, and in a new column delimit by " - ", and you'll split the columns into "bhw" and the number. Then just sum those numbers. Again, I get that notepad is simple and reliable, but when it comes to numbers like that, it is so much easier to use a program that is literally made to do things like that.

If you need help in how to do this, I am more than happy to show you.

Hey man. You were the last person I expected to answer after our little interaction the other day :)

First I'm gonna try and get something created that will do this without requiring an action from me. Not sure what yet, that's why I asked here. Maybe c#, or, c++, or java, or python, or autoit, or something else. I mean the math required is elementary, just not sure what can be made to work on Windows exactly how I want to do it.

Ultimately if I don't manage to take care of it how I envisioned it I guess I'll settle for doing it manually.

Thanks :)

find a c# or c++ programmer or even Java , it's very easy for him to do it i believe , any beginner programmer will do it for you because the idea is simple ,

Okay, that could work. Can c# or c++ or Java be made to work on Windows 10 in a way to where it just sits and monitors a file, and then does the math I need with 1 click, or even better automatically every X hours or whenever... I don't know... the mouse hasn't moved for X hours?

This can easily be done in Python. Just google some example scripts of adding up numbers in a text file.

Okay, that could work. Can Python be made to work on Windows 10 in a way to where it just sits and monitors a file, and then does the math I need with 1 click, or even better automatically every X hours or whenever... I don't know... the mouse hasn't moved for X hours?

No offense bro but if you are not willing to learn new things you won't get any solution to your problems.
This thread is like - I want to cut down huge tree with a swiss knife. I dont want to use saw, chainsaw and I don't want discussion about it.
Your approach is just wrong. You can learn how to code or use notepad++/Excel at pro level in X hours, you can also waste 5-10 times X hours looking for solutions that cant be found in way you want them.

Trust me if you dont know how to code you didnt ever see real automation in action.

I was thinking about that when I was posting this thread yesterday. I feel a little differently about it. I feel like this thread is like I have a car and I want to install a cupholder in it, but I don't want to buy a brand new car just to get a cupholder :D

I guess we're both right in a way. And you probably are correct that I haven't seen real automation in action. But I do what I can :)

Excel is the way to go...

Ok thank you.
 
Lately ive been automating every little thing i can in my daily work. And now i want to automate a little something in notepad. Not notepad++, just the regular plain old windows notepad.

So i have a file with hundreds of lines that go something like this:

Something something
Bhw - 34
Bhw - 543
Bhw - 128
Bhw - 97
Bhw - 261
Bhw - 33

Something something
Bhw - 452
Bhw - 39
Bhw - 252
Bhw - 48

And on and on it goes for hundreds of lines. And i find myself adding up those numbers manually. So the second example would become:

Something something
Bhw - 791

Im looking for something i could run manually and it would just go through the entire file and add them all up. Or even better something running in the background at all times, and for example adding them up after 1 hour of inactivity, or once per day at a specific hour.

Any ideas what i can use to do this?

p.s please keep the suggestions that i should use notepad++ or word or some other program instead to yourself. Nothing is as fast and realiable as the notepad, and i dont want to have a discussion about it.

Thanks :)


Here is a powershell script to parse it out & sum the total:

function Print-Greetz {
Write-Host -foreground Green -background Black "..:: Script Sample Courtesy of m13-io ::.. "
Write-Host -foreground Green -background Black "..:: $date1 "
Write-Host -foreground Green -background Black "..:: Feel free to donate at the following: "
Write-Host -foreground Green -background Black "..:: BTC - bc1q3ztgj7ea3q2n4ufnz8ejlswzz75yvanxu45gr8 "
Write-Host -foreground Green -background Black "..:: LTC - ltc1qd54ssjc8843rwy9y7vc2s2rr2wep7qzttxhszg "
Write-Host -foreground Green -background Black "..:: ETH - 0xa35a7e145f9056df6d76685defffb5529d73b52c "
}

function Get-Total {

<#
.SYNOPSIS
Function to sum the second column of numbers from a given file

.DESCRIPTION
Given a file has 2 columns separated by a " - " value, the 1st column being a string
and the 2nd column being a whole integer.
Then declare an outer loop total to accumulate the total through the loop
Then loop through all lines in the file, parse out the second number
Then display the total to the end-user.

.PARAMETER greetz
Type: Boolean
Display the contents of the Print-Greetz function in the execution of this function.

.PARAMETER source
Type: string
This is the path to the source file that you would like to have totaled.

.PARAMETER regex
Type: string
This is the regular expression you would like applied to parse each line in the file.
If the line does not satisify this regular expression criteria then nothing will be printed
and that line will be skipped.

.EXAMPLE
The following is an example of this functions typical usage:
PS C:\> Get-Total -greetz $false -source "c:\code\temp\2col.txt" -regex ".*[ ][-][ ].*"

.NOTES
Author: m13-io
Last Edit: 09/22/2019
Version: 1.0 - initial release
Donations: BTC - bc1q3ztgj7ea3q2n4ufnz8ejlswzz75yvanxu45gr8
LTC - ltc1qd54ssjc8843rwy9y7vc2s2rr2wep7qzttxhszg
ETH - 0xa35a7e145f9056df6d76685defffb5529d73b52c
#>


Param ( [bool]$greetz = $true
, [string]$source
, [string]$regex)

if($greetz) {
Print-Greetz
}

$date1 = Get-Date
$regex = ".*[ ][-][ ].*"
$tot = 0
foreach($line in Get-Content .\2col.txt) {
if($line -match $regex) {
$num = $line -split " - "
Write-Host("Key: " + $num[0] + " Value: " + $num[1])
$tot = $tot + $num[1]
}
}
Write-Host "Total: " $tot

}

Get-Total -greetz $true -source "c:\code\temp\2col.txt" -regex ".*[ ][-][ ].*"
 
R or Python can do this for you...
You can use windows scheduler to set when you want your action to be done
 
Ok guys I took care of this. I paid $15 for a solution.

It's a simple copy paste in, click, and copy paste back work to do this from now on. Maybe not 100% automated, but still happy with the solution I got.

Thanks all for replies :)
 
Back
Top