Powershell: Fire HTML Form Element Javascript with jQuery


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 trying to figure out how to get that second element populated. The code above (swap out your id element for mytext) will force the associated javascript to fire. It’s embarrassing, but this took forever for me to figure out. I had resorted to emulated keystrokes – but emulated keystrokes don’t allow your automation to continue behind a screensaver.

While I’m on it – why does the below code work? I can’t find documentation on it.



Using Python to make an API call to

import json,urllib.request
response = urllib.request.urlopen("").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, much more reliable too (the IE DOM randomly fails for me).


PowerShell Exception 0x800A01B6

I wanted to draw attention to this link to save somebody that headaches that I had trying to use $ie.Document.getElementById. Hope it helps.

Exception from HRESULT: 0x800A01B6
At line:21 char:1
+ $ie.Document.getElementById("RandomButton").click;while($ie.Busy) { St ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], NotSupportedException
+ FullyQualifiedErrorId : System.NotSupportedException

Always use the following methods instead of the native ones:

  1. IHTMLDocument3_getElementsByTagName
  2. IHTMLDocument3_getElementsByName
  3. IHTMLDocument3_getElementByID



Automatically Play Music After the Game with IFTTT and Pivot Power Genius

For some reason, I’ve been trying to come up with a way to automatically (triggered somehow through the internet) play a song at the conclusion of a sporting event for some time now. I’m not a programmer, I still haven’t really put a good-faith effort toward learning how to work with Arduino, and I’m not an expert on crawling the web for data (especially when it comes to “live” data, like a sports score). Still, this works, but let me go through the limitations.

  1. The sound quality is awful. We’re going low-tech here.
  2. Requires buying a Power Pivot Genius. Only $20 though, right now anyway.
  3. There are multiple potential points of failure. Not like this should be a mission critical thing for you, but still.
  4. You might cut your hands.

First, a little bit about the Power Pivot Genius (PPG); It’s a glorified power strip with two outlets that can be controlled remotely. No dimming, just on/off. You control it through the Wink App. It can also be controlled through IFTTT.

I’ve posted about IFTTT before, so surprise, we’re using it again. We’re going to use the ESPN module as a trigger to turn on one of the outlets on the PPG. It should look like this.



So, assuming you were able to set up your PPG, connect it to IFTTT , and then create the above recipe, you’ve now got an outlet that turns on when there is a “New final score for the Chicago Cubs”. Yep, that means win or lose. Now we just need an mp3 player with a speaker that plays our chosen file immediately upon power up. I found one.

This isn’t my video, but I find it hilarious. Anybody who forces their guests to listen to “The Final Countdown” while they use the restroom is cool by me. Anyway, you can buy one of the little players on Amazon for about $10.  When it arrives, you need to pry the cheap plastic front off. I don’t have a video for you, and the linked video doesn’t show you how. This is how I cut my hands. Take a flat-head screwdriver and work your way around the lip. You’ll break it. Once you get it off, there are four tiny phillips-head screws on the four corners – remove them so you can get to the battery. Cut the wires to the battery; we don’t want this thing charging. Only on/off. Put the screws back in.

Now, go get your song, put it on a low-capacity USB drive you don’t use anymore (or microsd, there’s a slot for it), and power it up on any wall outlet. You will need a USB to wall plug adapter (surely you have an old one not in use) to have the PPG power it. It should play after a few seconds. If it doesn’t, the switch on the side of the unit may not be set to “ON”. It won’t play if it’s on “OFF”, but it will do a disco thing (making you think it should be playing), which was confusing. If it’s playing each time you plug it in, mission (almost) accomplished. Plug it into the appropriate outlet on the PPG and you’re good to go.

However, there is one problem; we’re sending the instruction to turn on the power. This MP3 player will play your song (or list of songs, I guess) until it’s shut off. That means that we need a separate command. Through the wink app you can create a “robot” to detect specific conditions and, if met, execute a command. Not unlike IFTTT. We want to create a robot that detects whether the outlet we’re manipulating has been on for X amount of minutes. In our example, 3 is almost perfect.

Screenshot (Jul 21, 2015 9-46-02 PM)


So, now the outlet will be shut off and not repeat endlessly.

Katie already hates it.


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.

  1. 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 running the patch cable. This can resolve heat and noise issues without a lot of work. Also, if you have it connected to a HDMI switch, you can attach a bunch of random sources, saving a lot of space and keeping clutter from your living room.
  2. When you decide to put your stereo receiver in a cabinet, make sure the cabinet is the appropriate depth. I didn’t include the volume knob or cable protrusions in the rear in my measurement, and now its a real problem, because I cant shut the cabinet door.
  3. Have a handyman in addition to your contractor so they can work on the little details while other things are going on.
  4. Error on the side of caution when picking your paint sheen. We went too flat and now the tiniest touch leaves a mark that we cant clean off. I didn’t want light reflection from the projector on the walls, but the tradeoff isn’t worth it.
  5. Consider heating the bathroom floor. Katie mentioned it, I laughed it off. Being in the basement, against the concrete floor, the tiles are like ice cubes. Didn’t expect it to be so cold.
  6. Insist that the contractors work within the infrastructure you’ve already had set up. Our electrician (and home theater guy, long story) and general contractor didn’t even think about making sure the new smoke alarms would be connected to the existing hard-wired network of smoke alarms. We had to push and pay more for it.
  7. Without direction, your general contractor will use extra supplies he has stockpiled from past jobs (of variable quality) or the cheapest thing he can use to reasonably accomplish what he set out to do. Random things have been replaced as they’ve been discovered.
  8. Use Amazon Warehouse Deals for supplies. This is a great thread to monitor for things you know you’ll need.  Way cheaper, but a lot of it is unusable.
  9. If you’re not carpeting a huge area, shop remnants. We got a good deal on some nice carpet and used the savings to buy a better pad. Don’t cheap out on the pad.
  10. This is a great time to have z-wave switches and dimmers installed. They work just like any regular switch does, but give you some really cool home automation possibilities later on. I only did one like this, and I regret it. I’ll be replacing all of them at some point.
  11. Examine the contractors work closely every day. They will guess, make mistakes, assume things, and need to be corrected.

I’ll add more as I think of it. We’re happy with the results, but just because you’re not doing it yourself does not mean it will be easy. We still haven’t brought in furniture, finished the cabinets, or put anything decorative up.


Christmas Radio ’14 – Now Live! is now the best way to get here.

This little app autoplays, fair warning.

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 considering a few different options for what to do next, but since broadcasting over low power AM is a big goal, licensing is a problem. I’m trying to come up with something that is genuinely listenable and interesting, without somehow running afoul of those licensing issues, costing a lot of money, or being needlessly complicated.

So here’s the tentative schedule (work in progress):

Weekdays – 6AM to Noon: Classical Christmas Music (Orchestral, Choir, Nutcracker, etc). Noon to 7PM: Haven’t decided. 7PM to Midnight (M-Th): Old favorites, Rat Pack, Bing Crosby, Nat King Cole, etc.

Overnights – Midnight to 6AM: Probably setting the thing on random since nobody will be listening.

Friday evenings – 7PM-10PM I’m thinking about doing custom shows each week with themes. I’d like to get some homemade stuff here.  Haven’t decided yet. From 10PM to Midnight – Everything weird and anti-christmas I can find, and I have a lot of it. NSFW or kids.

As you can see, there are still some big gaps yet to be figured out, particularly on the weekend.

Last year I played the audio for classic Christmas movies, trying to find a good time to do that. I’d also like a slot somewhere (each) for R&B, Jazz, newer pop, etc. I’m thinking of having each of M-Th evening have a theme (one of the the aforementioned) and just going with that.


If you’d like to do some kind of custom message, I will put it on the stream. Just call 217-953-0286 and leave it on the voicemail.


Sonos Instructions to add Shoutcast Station: Link 

App to listen on iPhone: Link

I’ve got three Extreamers that I’m configuring to do nothing but play this Shoutcast stream. All you have to do is connect a network cable on one side, and the audio cable to your receiver on the other. If you want to borrow one, let me know.


IFTTT twitter

Making your Twitter User Image or Background Auto-Update with IFTTT

You can be annoying to the people that follow you on Twitter by changing your profile picture. You can be even more annoying by doing it often. Here’s how you can do just that.

IFTTT Pocket

RSS -> IFTTT -> A True Replacement for Google Reader

When Google announced that they were going to permanently shutter Google Reader, I wasn’t sure where to go. Well, that is, after the initial shock. Why, Google? Anyway, I went through and tried a bunch of different replacement services and none really felt right. So, I found a better option. Here’s how you can do it too.


Obihai Devices and Multiple Google Voice Accounts

Edit: You can pretty much disregard this post; Google announced that they are ending the service that allows for the Obihai devices to make free calls. Keeping it here for historical purposes.

I’m a big supporter of all the different Obihai VOIP devices. I’ve had an Obi110 since they launched for $50. For the uninitiated, these devices connect to various VOIP providers and allow for voice calls via an internet connection (there is a NIC in the device). The big selling point (especially at launch) is that it can interface with a Google Voice, which means free calls (no 911 service, but there are workarounds).  My problem deals with the fact that my Obi device has one Google Voice number, and I have a separate Google Voice number for myself. Google Voice will not forward a call to a Google Voice number.