Tag Archives: Guide

Python: How to Automate Word Docs

Header

Every time I start thinking that my job is bad, I try to remind myself that Stanley Kubrick had a secretary. The guy was notorious for driving actors into the ground. Making them do takes over and over and over. Can you imagine having to handle his administrative work?

If IMDB’s trivia page is to be believed, that poor soul had to spend weeks typing out the infamous ‘All work and no play makes Jack a dull boy’ novel from hell. On the off-chance I ever find myself similarly working for a maniac, I’m attempting to master the Python docx module, and I’ve been pleasantly surprised with how far you can get with just the basics.

Continue reading

Advertisements
Tagged , , , , , , , , , , ,

AHK: Visualizing ELSE/IF with Arrays

So Hopper’s Amazing Decipherer Script 1.0 was about 472 lines because it included ELSE IF clauses for every letter in the alphabet.

HADS 2.0 cuts it down to 77 lines because arrays, as it turns out, are incredibly useful when paired with loops.

Making a Rotated Alphabet

Deciphering a Caesar cipher requires that the alphabet be moved up by a certain number. Like so.

ROTchart

Notice that this is basically a 2-step process. Turn the letters of the alphabet into numbers 1-26. Then add the rotational value to each of them to find their new positions, in the code below that’s assigned to a variable called indexVar. In ROT1, A =1 and the rotational value is 1, so A = 1+1 = 2.

But what happens when you hit Z? Z=26 and the rotation is 1, so Z =  26+1 = 27.

So, you want to tell the computer IF the number goes above 27, then you want to reset it to 1 and continue.

A Slow Motion Loop

Continue reading

Tagged , , , , , , , ,

AHK: How to Loop Code through Images

Need to make changes to every pixel in an image? As it turns out, that’s not so difficult with AutoHotkey. From what I’ve been able to gather, all you really need is the height and width of the picture so that the loop knows how many times to run and the XY coordinates of the picture’s upper left corner.

The Code

Note that CoordMode, Pixel, Screen tells the computer to use the XY coordinates relative to the screen rather than the window.

CoordMode, Pixel, Screen

Height:=Height of the Image
Width:=Width of the Image
Xaxis:=X-Coordinate to start at
Yaxis:=Y-Coordinate to start at

loop, %Height%
{
loop, %Width%
{

Do This Code, Xaxis, Yaxis

Xaxis++

}
Xaxis:= Xaxis-Width
Yaxis++
}

How the Loops Work

Continue reading

Tagged , , , , ,

AHK: How to Make a $hit Ton of Files in 60 Seconds

For future reference, I’m posting the code at the top. Details follow below.

STEP 1: Make a new AutoHotkey file. Don’t know what that is? Don’t worry. It’s real easy.  Click here.

STEP 2: Go into your C Drive. Make a folder called Folders1_200.

CDriveMakeFolder1

STEP 3: Right click your new AutoHotKey Script → Edit Script.

Continue reading

Tagged , , , , , , ,

My Laptop is a Parasite.

Let me start off by saying, my computer is the soul-sucking spawn of Satan.

For that reason, I hope she dies a painful death, preferably boiling in a vat of holy water after having had each of her keys gouged out. We have a very volatile relationship. Codependent, verbally abusive, and just f%#ing nonsensical at times.

But I spend 99.999% of my time with her because I thought eventually we’d develop a healthy, loving, symbiotic relationship. This has yet to happen. You ever heard of the tongue-eating parasite? That’s us. And I do not have the cushy end of that deal.

I run antivirus checks. I keep her charged. I never open more than three programs at a time. I even stop what I’m doing when she tells me I have to run updates. But instead of doing the polite thing and gnawing away at my appendages, she’s slowly devouring my sanity. Piece by piece.

So… In an attempt to recover some semblance of balance, I am learning how to code. Sort of. Really, I’m trying to wrangle my machine into submission. I’ll be posting my progress for others out there who are similarly tethered to an HP from Hell.

Sincerely,
The Terminally Confused

Tagged , , , , ,