Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
TheMostFrench
Jul 12, 2009

Stop for me, it's the claw!



Hey, looking for some advice. I'm currently in charge of doing monthly invoices for my department, but a number of companies we use don't email out invoices - you have to download them from their website or take a screenshot of a receipt on the account (spotify is like this). What I want is to be able to retrieve all the information each month and get it in one place, instead of visiting multiple sites and crawling through outlook. Sometimes company emails attach an invoice, but others will say 'your invoice is ready' with a link.

Where might I get started? I know some basic Python and C#.

Adbot
ADBOT LOVES YOU

Butter Activities
May 4, 2018

Automate the boring stuff will get you started with how you could make a script that would read your email then identify “your invoice is ready” but if your invoice endpoints are in non standardized formats much less screenshots this is gonna be a pretty elaborate project for a beginner.

You could start with a bot that just gathers up invoice links, then add modules to read the text first then maybe eventually read images but that’s a lot more advanced of a project.

You’ll probably need the smtplib BeautifulSoup and Re(gular expression) library to do that well. That would also be enough to interpret text files and output and standardize the information you want from those invoices. How you would read an image is way beyond anything I’ve ever done.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

bandaid.friend posted:

I did it. I touched a computer. Wow



late posting but you could have easily replaced one my previous devs just through the fact you're actually trying (keep it up!)

Analytic Engine
May 18, 2009

not the analytical engine

a hot gujju bhabhi posted:

late posting but you could have easily replaced one my previous devs just through the fact you're actually trying (keep it up!)

yep, I'm happy to recommend bandaid.friend

DerekSmartymans
Feb 14, 2005

The
Copacetic
Ascetic
Is there any code for starting a script/program in python? I can’t get anything to run even the examples in AtBS. I get syntax errors and, sometimes (even if I indent),the print() statement just prints what I type and won’t go further.

These things happen whenever I press f5 to or tell notepad++ to run. I’m absolutely positive I’ve run the code EXACTLY as written and nothing happens. I don’t know if there is something to start with or save as because nothing else is working, either.

opie
Nov 28, 2000
Check out my TFLC Excuse Log!

xtal posted:

If you want to learn the logic of a game without being too complicated and mathematical you can try making a text-based game first. You'll get introduced to game loops, input and world state. Then you could either adapt it to be graphical and use the same logic, or start working on a graphical game and not need to learn about those things at the same times as linear algebra.
This is what I do, because for me it’s the most fun part. I write the logic in c++ and then an ai to test it. An example is a risk-type game where it randomly generates a map. Then the 2 player ai selects territories, and each player tries to gain control of adjacent territories until no moves are left. The attacks are weighted based on the number of adjacents. Eventually i’ll add other stuff but the skeleton is there. I used this and some other game logic to test some performance tools, but graphics is going to be the main bottleneck once I add it.

And graphics is really tough for me because there are so many toolkits and frameworks to deal with, where c++ is just do some math on this data and try not to gently caress up your allocations. I understand the graphics at a low level, but drat if I can build a GUI to drag and copy a square from one region to another.

Rod Hoofhearted
Jun 18, 2000

I am a ghost




DerekSmartymans posted:

Is there any code for starting a script/program in python? I can’t get anything to run even the examples in AtBS. I get syntax errors and, sometimes (even if I indent),the print() statement just prints what I type and won’t go further.

These things happen whenever I press f5 to or tell notepad++ to run. I’m absolutely positive I’ve run the code EXACTLY as written and nothing happens. I don’t know if there is something to start with or save as because nothing else is working, either.

I don't know notepad++, but it sounds like there's something extra you have to do to "install" Python on it. For example, the first IDE I downloaded was Visual Studio Code and there was an extra step to install Python on it, almost like a plug-in or something.

I would advise you just to download IDLE from Python.org. I tried VS Code because of a Python training video I was watching and it overwhelmed me, whereas IDLE is much more basic and no-frills, so I can concentrate on learning Python first, and then I'll learn more about IDE's later.

Butter Activities
May 4, 2018

I use Anaconda now but IDLE is perfect for starting out.

DerekSmartymans posted:

Is there any code for starting a script/program in python? I can’t get anything to run even the examples in AtBS. I get syntax errors and, sometimes (even if I indent),the print() statement just prints what I type and won’t go further.

These things happen whenever I press f5 to or tell notepad++ to run. I’m absolutely positive I’ve run the code EXACTLY as written and nothing happens. I don’t know if there is something to start with or save as because nothing else is working, either.

What environment? How did you install Python and what OS do you have?

DerekSmartymans
Feb 14, 2005

The
Copacetic
Ascetic

SpaceSDoorGunner posted:

I use Anaconda now but IDLE is perfect for starting out.


What environment? How did you install Python and what OS do you have?

Win10, and I have IDLE installed with the 3.7.4 version of python (not sure if that’s right, but I dl’ed the entire 3.7 program and even went back to 2.7 just to check).

IDLE comes out looking like notepad if that helps. Certain commands come out with a different color codes but I don’t know if it’s helpful. I

Sophy Wackles
Dec 17, 2000

> access main security grid
access: PERMISSION DENIED.





DerekSmartymans posted:

Win10, and I have IDLE installed with the 3.7.4 version of python (not sure if that’s right, but I dl’ed the entire 3.7 program and even went back to 2.7 just to check).

IDLE comes out looking like notepad if that helps. Certain commands come out with a different color codes but I don’t know if it’s helpful. I

What happens when you type python in the command prompt? Does the interpreter come up where you can start typing in code? It may be that you are missing some environment variables in windows.

If you want to run in an IDE instead, I really like Visual Studio Code. You just need to install the python extension from within VSCode (it's the one made by microsoft and probably the first search result). Here's a tutorial to get it set up:

https://code.visualstudio.com/docs/python/python-tutorial

TheMostFrench
Jul 12, 2009

Stop for me, it's the claw!



DerekSmartymans posted:

Is there any code for starting a script/program in python? I can’t get anything to run even the examples in AtBS. I get syntax errors and, sometimes (even if I indent),the print() statement just prints what I type and won’t go further.

These things happen whenever I press f5 to or tell notepad++ to run. I’m absolutely positive I’ve run the code EXACTLY as written and nothing happens. I don’t know if there is something to start with or save as because nothing else is working, either.

If you created a definition you need to include it at the end to make the code actually run. That used to get me constantly.



I was introduced to a pretty simple IDE called Thonny (that's what I'm using in the pictures) which installs python along with it in one package, and has a built in shell to see output. https://thonny.org/
The interface is very simple, I found stuff like visual studio was kind of overwhelming to begin with, but notepad++ was TOO simple.

When you enter debug mode (ctrl+F5) keep pressing 'Step into (F7)' to see how it assigns variables and goes through iterations.

When you step into loop_simple it will open a new window with that code isolated.
Each time you use 'step into' to go through the list you can see the current value of 'i'. Then the next step assigns that value to print(i) and finally displays it in the shell.

If you are getting syntax errors something like this can be very helpful, because you can step into each line of code and it will keep working until it gives you an error and you can see exactly when the problem occurs.



In my screenshots if I don't have loop_simple() on line 5 then the code won't actually run in the shell, but there are no errors either because the syntax is correct. If you didn't know what was missing it would feel like your code was 'wrong' because it didn't appear to be doing anything, but as far as the interpreter is concerned it is correct and you simply didn't tell it to run (even though you clicked 'run').

Don't be afraid to read guides from different sources, I find some guides aren't specific enough and assume a certain level of understanding.

TheMostFrench fucked around with this message at 03:56 on Aug 29, 2019

marijuanamancer
Sep 11, 2001

by Jeffrey of YOSPOS
keep going. solve puzzles

marijuanamancer
Sep 11, 2001

by Jeffrey of YOSPOS
ive been messing around in go and its a lot like a scripting language for a systems language.

i have to give rust a fair go still

DerekSmartymans
Feb 14, 2005

The
Copacetic
Ascetic
Thanks for the help, guys (and maybe girls—I don’t judge 🤓). Those answers made a lot of sense when up against all the errors I was throwin’ and I think I’m gonna go through the python help for beginners THEN go back through AtBS.

Sophy Wackles
Dec 17, 2000

> access main security grid
access: PERMISSION DENIED.





TheMostFrench posted:

Hey, looking for some advice. I'm currently in charge of doing monthly invoices for my department, but a number of companies we use don't email out invoices - you have to download them from their website or take a screenshot of a receipt on the account (spotify is like this). What I want is to be able to retrieve all the information each month and get it in one place, instead of visiting multiple sites and crawling through outlook. Sometimes company emails attach an invoice, but others will say 'your invoice is ready' with a link.

Where might I get started? I know some basic Python and C#.

Some packages for python you should look in to:
requests for downloading documents
re for regular expressions
beautifulsoup4 for searching/parsing webpages
PIL and pytesseract (and Google tesseract) for OCR

Then depending on what format your invoices are in, you might need some others to parse pdf, etc

Sophy Wackles fucked around with this message at 07:19 on Aug 29, 2019

Adbot
ADBOT LOVES YOU

TheMostFrench
Jul 12, 2009

Stop for me, it's the claw!



The progress I've had time to make on that so far on that has been to open outlook and check inboxes for attachments using win32com. I got to a point where I could check the subject lines for an email, but iterating through them counted forward from the oldest email and now I need to work out how to go backwards through them to find the most recent invoices. What I've read about suggests that outlook treats content in shared folders differently from inboxes, some things are called mail items and others are just 'objects' which have different methods. I don't have the code in front of me to share but that's the current hurdle. Feels like progress though, which is great!

TheMostFrench fucked around with this message at 14:11 on Sep 13, 2019

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply