Powershell: Implementing Automated Screenshots

I needed screenshot functionality for my testing framework. Typically when something fails, I have most of the environment variables to investigate along with the error codes, but a screenshot gives additional context, particularly in my browser automation stuff. There is no native command to do this in Powershell v2. So, I combined three different scripts I found while trying to sort …

PowerShell: Download Movies from YouTube with Invoke-Webrequest and youtube-dl

Disclaimer: I have no knowledge of the copyright status (public domain or otherwise) of individual movies uploaded to YouTube. Use good judgement. Did you know that people apparently upload entire movies to YouTube? In fact, there’s a subreddit dedicated to finding these movies. I’d rather have the movie files themselves rather than be reliant on a browser or app to watch …

IE

PowerShell: Accessing Data in IFRAME in IE Com Object

A lot of my work involves using PowerShell and the IE com object to extract data. We’ve got a VOIP system at work that is really inflexible and doesn’t have any “critical level” functionality – ex: supervisors need to be notified if the call center’s current on-hold levels are extreme. The problem has been that the intranet portal with this …

microsoft word

PowerShell: Automating Search and Replace in Microsoft Word

I’m required to send various letters and internal memos on a schedule. I hate taking the boilerplate and going through and manually updating it to reflect the current period’s numbers, but there really aren’t  many options. The folks receiving the communications expect it in a specific format, and they don’t like surprises. This means I’m using the same Word documents …

IFTTT

PowerShell: Trigger IFTTT Maker Channel using PowerShell v2

I’m in an environment where only PowerShell version 2 is available, which limits functionality and forces me into workarounds. I’ve been interested in using the Maker Channel on IFTTT in PowerShell for some time, but everybody seems to be using Invoke-RestMethod, which is unavailable in PowerShell v2. The following function uses the .NET object System.Net.WebClient to accomplish the trigger in the older …

Python: Automating Analog Video Capture with pyautogui

Early in December I was talking to a co-worker about how expensive tape-to-digital conversion was. I was charged over $60 locally for less than a couple hours of tape – and when I saw their setup, it was an Elgato Video Capture device. I put it on my Amazon wishlist, and it went on sale (almost immediately after I had the …

Parsing Football Records from IHSA.org with Python and BeautifulSoup

If you run the attached python code, you’ll output a little over 36k records, every high school football season that the IHSA website has a record for. The IHSA website is fantastic for historical data, but the data is not easily manipulated or downloadable, so I spent some time learning the python library BeautifulSoup to force the issue. Without spending …

Powershell: Fire HTML Form Element Javascript with jQuery

$ie.document.Script.execScript(“`$(`”#mytext`”).trigger(`”change`”);”) If you’re tasked with the automation of a form element, you will find that most of the time this manipulation will not fire javascript code necessary to complete your task. Consider a dynamic dropdown box – you make your selection in the first element, and now that you’ve chosen, the second element is populated. With automation you’ll be stuck …

Using Python to make an API call to data.cms.gov

import json,urllib.request response = urllib.request.urlopen(“https://data.cms.gov/resource/qsk8-thmv.json?PRVDR_NUM=01D0026356”).read() obj = json.loads(response.decode(‘utf-8’)) print (obj[0][‘fac_name’]) Here is how to get a response from CMS on a specific CLIA record. Here is the actual table you’re querying. CMS is actually pretty awesome to give access to all of this.