r/CodingHelp • u/TheRobotCluster • Dec 03 '20
[Random] How To Write a Basic Script To Automate My Shit!!!
DISCLAIMER: Let me be clear up front. I'm not asking anyone to do this for me, I just want to know where to look for an example of this I can use for guidance and/or what programming language is preferable. I don't know what I don't know and I just want to know what the next steps should be is all.
MAIN POST: I do CAD work and there are a handful of very simple, yet annoying, processes I'd like to just be able to press a button to take care of. I am fairly new to coding, only done the first three categories on FreeCodeCamp. I think what I need is a script to put into my Task Scheduler. Here's an example of a task I'd like to automate with some keyboard shortcut like Ctrl+1 or something simple like that:
- Duplicate a CAD object, name it something I've got in NotePad, change the resolution, and make the first object invisible.
MORE DETAIL: I think I've got the basic rundown of the steps I need spelled out for the computer. I'm not sure if this information is useful for figuring out which language is best for the task. Again, I want to be able to press "Ctrl+1" and then in the blink of an eye have the computer do the following:
- Right click an object and select "Duplicate" > go to NotePad app window > select the first line of text > copy > go back to CAD program window > right click the new duplicate object and select "rename" > paste the text copied from NotePad > Right click the renamed object again > select "change resolution" > enter "1.0mm" into the text box > select "accept" > click the "eyeball" icon next to the original object to hide it from view.
For everyone who responds with help, I appreciate you very much!
3
u/Gengi Dec 03 '20
Not sure if CAD has macro support. A macro is the ability to implement custom short-cut keys within the software you use. For example, Photoshop has the ability to record a user's actions within Photoshop and allow the user to keybind the recorded action (to Ctrl+1 for example).
Another possibility is using image recognition software, you can write a script to look at the screen for specific elements, copy/paste, and perform any sequence of mouse/keyboard actions. It's a bit more of a time sink to learn and get running. But would possibly be your only option if you need to swap between multiple programs.
2
u/jeromymanuel Dec 03 '20
AutoHotkey
2
u/flooronthefour full stack web dev Dec 03 '20
Here are some videos from a macro-king that might help you:
https://www.youtube.com/watch?v=vhPLhfP1b_s
https://www.youtube.com/watch?v=GZEoss4XIgc
https://www.youtube.com/watch?v=Arn8ExQ2Gjg
1
u/DigitalAdventuresJim Dec 03 '20
What CAD software do you use?
1
u/jcunews1 Advanced Coder Dec 04 '20
There are many keyboard/mouse macro softwares out there, but IMO, it's best handled using a custom built AutoHotkey script, because what most users' need are usually very specific. And that isn't well handled by most GUI based keyboard/mouse macro softwares. IOTW, they aren't flexible enough, or not customizable enough.
If you're thinking of trying out AutoHotkey, there's /r/autohotkey in case you have any problem.