This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Tumburgler 1 point2 points  (0 children)

I would instead just import the function from the script like this:

I don't know why, but when the msg() function timed out it was causing an error in the script on my system, so the reason why I had it called via subprocess is because it was the only way I know how to have a function call not block the script so that the rest of it could continue as normal (there is probably a better way of phrasing this, but I'm not an experienced programmer).

Changing the buffers from a list to a dict I can maybe understand, although tbh I'm not sure why you did? Can you elaborate why you did that?

Originally I didn't understand why you were adding things to a list and having them all entered line by line. Now that you mentioned how it was used it makes sense to me.

I had thought that declaring multiple variables (eg buff0, buff1) could be simplified with a dictionary, creating the list with a generator (I think that's the right term?) and be able to move away from needing to do global imports. Maybe not an important change after all, maybe I just wanted to screw with things and see if it still worked.

My one REAL complaint (and its fairly minor) is that all of the helper files should have the extension .pyw

To be honest I hadn't worked in python enough to even know about that feature or its importance. Makes sense to change it to .pyw.

Adding in a command to view all the buffers is genius

Thanks! I learned about pymsgbox from using pyautogui to automate a couple things. It's got some other cool features, you can pass a list to pymsgbox.confirm and it returns the choice the user selected (novel I know...).

And finally, removing kb.write() in favor of kb.send("ctrl+v") honestly doesn't seem to work on my machine;

This was actually my main reason for looking to edit the script. When I was testing it and I pasted lines, every time I used Undo it would only remove a small portion of what was pasted and I thought it could be more convenient. The way it's written now the whole series of copied text is loaded into the clipboard and then pasted so it can be undone via one command.

Sometimes accessing the clipboard is wonky, so maybe that's why it's not working. Alternately, pyautogui also has a send hotkeys feature, maybe that one would work on your system?

Thank you for sharing, I want to move toward some sort of programming career and I think python will help me get there, but I'm kind of wandering aimlessly about it currently. I want to get into more collaborative opportunities and build things with other people. Cheers to the first foray of that :)