| Windows 7: About to start a new project & looking for advice |
04 Jun 2011
|
#1 | | Windows 7 Home Premium 64bit. |
About to start a new project & looking for advice I work at a lumber yard and I have a bunch of text files (called pick lists) that start with about twenty to forty lines of pointlessness then gets to the data needed. It looks like this:
1,2x4,16',2100
2,2x4,14',#2
3,2x6,12',#2
1,2x4,10',#2
1,2x4,16',2100
2,2x4,14',#2
1,2x4,10',#2
3,2x6,12',#2
3,2x6,12',#2
......
QTY,SIZE,LENGTH,GRADE
I'm the guy that gets handed this printout and gets to count all this out (they are much longer like 2-3 pgs.) I know I can write something, somewhere to sort through these files and just print out the added QTY of each instance of similar size, length & grade. I just don't know where to start.
Thanks for any input
Last edited by McP2143; 06 Jun 2011 at 05:35 PM..
| My System Specs |
| OS Windows 7 Home Premium 64bit. |
04 Jun 2011
|
#2 | | Windows 7 Professional x64 |
This could be done fairly easily with a Python script. I would be happy to write it for you, but I am extremely low on time right now. If you don't need it before June 10th, I can write it for you. | My System Specs | | System Manufacturer/Model Number Lenovo ThinkPad W520 (4270CT) OS Windows 7 Professional x64 CPU Intel Core i7-2720QM Memory 4GB (2 x 2GB) Graphics Card NVIDIA Quadro 2000M (with Optimus) Hard Drives 500 GB @ 7200 RPM |
04 Jun 2011
|
#3 | | Windows 7 Home Premium 64bit. |
Wow I didn't expect an offer to write it for me!! Thank you Brice. Waiting is not an issue at all. I was planning on teaching myself some lessons in code as I assumed this would be fairly easy. I will get a few of the full files and post them here Monday night after work. | My System Specs | | OS Windows 7 Home Premium 64bit. |
04 Jun 2011
|
#4 | | Windows 7 Professional x64 |
No problem. Just PM me around June 9th or June 10th. It won't take too long and will be really good practice for me. | My System Specs | | System Manufacturer/Model Number Lenovo ThinkPad W520 (4270CT) OS Windows 7 Professional x64 CPU Intel Core i7-2720QM Memory 4GB (2 x 2GB) Graphics Card NVIDIA Quadro 2000M (with Optimus) Hard Drives 500 GB @ 7200 RPM |
04 Jun 2011
|
#5 | | Windows 7 Professional x64 |
Can you tell me what you'd like the program to display for the sample you posted above? | My System Specs | | System Manufacturer/Model Number Lenovo ThinkPad W520 (4270CT) OS Windows 7 Professional x64 CPU Intel Core i7-2720QM Memory 4GB (2 x 2GB) Graphics Card NVIDIA Quadro 2000M (with Optimus) Hard Drives 500 GB @ 7200 RPM |
05 Jun 2011
|
#6 | | Windows 7 Professional x64 |
I just finished the script. I have attached it and a sample data file. This is how it would work for the sample data you gave me above. (The file Sample Data.txt must be in the same folder as this Python script.) Code: Please enter the path to a data file: Sample Data.txt
Size Quantities:
2x4: 8
2x6: 9
Length Quantities:
14': 4
16': 2
10': 2
12': 9
Grade Quantities:
#2: 15
2100: 2 By the way, you must install Python before using this script. To do so, please click here and you will download the 64-bit version. | My System Specs | | System Manufacturer/Model Number Lenovo ThinkPad W520 (4270CT) OS Windows 7 Professional x64 CPU Intel Core i7-2720QM Memory 4GB (2 x 2GB) Graphics Card NVIDIA Quadro 2000M (with Optimus) Hard Drives 500 GB @ 7200 RPM |
05 Jun 2011
|
#7 | | Windows 7 Home Premium 64bit. |
Quote: 1,2x4,16',2100
2,2x4,14',#2
3,2x6,12',#2
1,2x4,10',#2
1,2x4,16',2100
2,2x4,14',#2
1,2x4,10',#2
3,2x6,12',#2
3,2x6,12',#2
...... for this example an output would be
9,2x6,12',#2
2,2x4,10',#2
4,2x4,14',#2
2,2x4,16',2100
This is a trimmed down example the real deal has many different lengths, sizes, and grades. I would also like any output of this to be in a new file. Thanks again. | My System Specs | | OS Windows 7 Home Premium 64bit. |
05 Jun 2011
|
#8 | | Windows 7 Professional x64 |
Oh, okay. I'll make some modifications to it to do that. | My System Specs | | System Manufacturer/Model Number Lenovo ThinkPad W520 (4270CT) OS Windows 7 Professional x64 CPU Intel Core i7-2720QM Memory 4GB (2 x 2GB) Graphics Card NVIDIA Quadro 2000M (with Optimus) Hard Drives 500 GB @ 7200 RPM |
05 Jun 2011
|
#9 | | Windows 7 Professional x64 |
I have now modified it to do everything you want, including putting the output in a new file. Please report back on how well this works, and please rep me if you find it useful. Thanks.
IMPORTANT: Make sure to extract the zip file before using the script. | My System Specs | | System Manufacturer/Model Number Lenovo ThinkPad W520 (4270CT) OS Windows 7 Professional x64 CPU Intel Core i7-2720QM Memory 4GB (2 x 2GB) Graphics Card NVIDIA Quadro 2000M (with Optimus) Hard Drives 500 GB @ 7200 RPM |
05 Jun 2011
|
#10 | | Windows 7 Pro x64 (1), Win7 Pro X64 / WinXP Pro x86 on (2) |

Quote: Originally Posted by BriceH I have now modified it to do everything you want, including putting the output in a new file. Please report back on how well this works. Seems to work exactly as expected. Very nice.
Since the input TXT file is clearly in a CSV (comma-separated variable) format that is suitable for importing into Excel, it also would seem that a spreadsheet solution with a simple SUM/DSUM function of some kind should also exist... since the data is already prepared and it's just a matter of adding the values in cells from one column based on matching cells in other columns being the criteria.
Give me one day.
(very simple COBOL program as well) | My System Specs | | System Manufacturer/Model Number Home-built, two systems (1) and (2) OS Windows 7 Pro x64 (1), Win7 Pro X64 / WinXP Pro x86 on (2) CPU i5-3350p 3.1Ghz/6MB-cache (1); E8400 3.0Ghz/6MB-cache (2) Motherboard ASUS P8Z77-V Pro (1); ASUS P5Q3 (2) Memory 8GB PC3-12800 DDR3 (1); 4GB PC3-10600 DDR3 (2) Graphics Card ATI HD5770 dual-DVI (1), (see TV cards); ATI HD4850 (2) Sound Card Realtek ALC892 HD Audio (1); Realtek ALC1200 HD Audio (2) Monitor(s) Displays Eizo HD2441W LCD, Eizo S2433W (1); Eizo 24" S2433W (2) Screen Resolution 1920x1200, 1920x1200 (1); 1920x1200 (2) Keyboard IBM PS/2 (1) and (2) Mouse Logitech MX Revolution wireless (1); Microsoft wired (2) PSU Nesteq ECS-6001 600W (1); Nesteq ECS-5001 500W (2) Case Acousti-Case 360 (1) and (2) Cooling Noctua NH-U12P SE2 for CPU, 2x120mm case fans (1) and (2) Hard Drives (1) 1TB SATA-II (7200RPM), 2TB SATA-II (7200RPM), 2TB SATA-III (7200RPM), 250GB SATA-III (10000RPM) for OS;
(2) 320GB SATA-II (7200RPM), 750GB SATA-II (7200RPM), 150GB SATA-II (10000RPM) for OS Internet Speed 15mbps down / 2mbps up Other Info Ceton InfiniTV 4-tuner cablecard-enabled TV card as well as Hauppauge HVR-2250 OTA/ATSC 2-tuner TV card in (1), running under Win7 WMC About to start a new project & looking for advice problems? All times are GMT -5. The time now is 06:15 AM. | |