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 … Read More

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 … Read More

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 … Read More

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 … Read More

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.

_IELinkClickByText in Powershell v2

function ClickLinkByText ([string]$arg1){ $ie.document.Script.execScript(“(`$(‘*:contains(`”” + $arg1 + “`”):last’)).click();”); while($ie.Busy) { Start-Sleep -Milliseconds 100 } } If you’re using Powershell v2 to automate IE, and the webpage you’re automating has jQuery, try this out.  I’ve been jealous of this function in Autoit, and this is much faster than the “normal” methods to find the link. If you’re on a weak workstation, … Read More

Finishing Basement / Home Theater Lessons Learned

I wanted to compile a list of all the things I figured out (often too late) while taking on the ridiculous basement project we just recently finished. So, here goes. HDMI over Cat 6 is a thing. Its utility isn’t immediately obvious, but consider this; You can take **all** of your AV equipment and house it somewhere else just by … Read More

Christmas Radio ’14 – Now Live!

radio.benbarnard.com is now the best way to get here. This little app autoplays, fair warning. Your browser does not support the audio element. Click through the following link to play through your streaming client instead (updated): So Christmas ’14 is over, but I’m not giving it up this year. For the time being, music licensed as creative commons will be playing. I’m … Read More