Tag Archives: Windows 7

Quickie Custom ‘Speak’ Protocol

Posted on by

I mentioned on Facebook I was thinking about adding the second protocol I did and also about changing this to a more tech related blog… Well, here’s the “Speak” protocol and I’m still debating on if/when I may do the blog changes.

If you came directly to this post, read the previous one to get an idea about Custom Web Protocols and an idea of what’s going on.

*Required Software*
For starters, this protocol uses some freeware called NirCmd (by NirSoft) which can be downloaded from the bottom of this page. Make sure to download the correct 32bit/64bit version and after you extract it, copy NirCmd.exe to your Windows\System32 directory either manually or by running NirCmd (it offers a button to copy it there automatically).


If you still have the *.reg file from the “Sublime Protocol” you can make a copy of that file and do some simple changes to create this, or if you’re starting from scratch open “Sublime Text” (or your favorite text editor… yes, even Notepad works) and copy/paste the following into your document. Don’t forget to save it with the *.reg extension.

Registry File
Warning:
Modifying the Windows Registry can be hazardous to your computer and cause data corruption, data loss, or just outright kill your system, therefore proceed at your own risk and I will not be held responsible for any damage you may/may not cause. This registry file has been tested and deemed safe on both Windows 7 and Windows 8 but has not been tested on XP or Vista.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\speak]
"URL Protocol"=""
@="URL:SpeakText"

[HKEY_CLASSES_ROOT\speak\DefaultIcon]
@="C:\\Windows\\System32\\shell32.dll,282"

[HKEY_CLASSES_ROOT\speak\shell]

[HKEY_CLASSES_ROOT\speak\shell\open]

[HKEY_CLASSES_ROOT\speak\shell\open\command]
@="C:\\Windows\\System32\\cmd.exe /K nirSpeak.cmd \"%1\""

Notes:

  • If you change the trigger for the protocol (speak) it needs all five references changed.
  • The double \ in the file paths are required.

The last line needs to be altered if you change the name of the Command/Batch file or you get a security error for running the Command Prompt (see previous post for info on this and how to fix it).

Batch File
Taking the name from the registry file, in this case “nirSpeak.cmd”, we create a new empty document with that name and copy the below code into it.

@ECHO OFF
TITLE Archigos NirSpeak
for /F "tokens=1,2* delims=/" %%a in ("%~1") do set protocol=%%a&set str=%%b
nircmd speak text "%str%"
exit

*Using*
There’s one large difference between this and the previous protocol (other than the obvious usage) in which this does NOT encode/decode the information sent which changes a few things with the usage. With the Sublime Protocol for example, if a filename contained a space, that would be converted to %20 and back again where required, but the Speak Protocol would actually say “percent two zero” if you tried to manually encode it. The easiest way to create speech is to create a variable with the entire string you want and than just putting the variable into the URI (which also prevents certain errors due to spaces like speak://multiple words would. It wouldn’t cause a PHP error, but NirCmd would most likely error out or only say the first word).

A great example of how you may want to use this would be to greet your user after they log into your site.

$username = $_POST['username]';
$greeting = "Greetings ".$username;

And then you’d use a JavaScript function or similar to invoke it (in this case: speak://$greeting) on page load or whatever. You could also use buttons or inputs in a similar fashion, like the button I use on one of my sites that reads the stats to the user.

echo "
";

*Final Thoughts*
Obviously both this and the Sublime Protocol could benefit from hiding the Command Window that is spawn but I wanted to write these using as little third party software as I could to make it easier on the reader. Oh and for those that want to play around with the speech function there’s a bunch of information on NirSoft’s website, but for the lazy, open a command prompt and type nircmd speak text "Hello World" and it will say whatever is between the quotation marks.

A lot of shit…

Posted on by

I've got my eye on you

So, 15 days ago on the 15th I wrote a post that got interrupted by taking my roommate to work and forgot what I was going to write about. A lot has happened since so I figured it’s after 4am and I can’t sleep, which is very typical, I’d write a mass pile of shit into one post. In the last two weeks, whenever I remembered what I wanted to write, I didn’t have the time and whenever I had the time I couldn’t remember anything. Man, I really hate my memory problems. I’ve collected a bunch of random crap I’ve wanted to toss into a post for awhile now, some to test new features, others just cause I’m THAT bored.

Um, let’s see… where to start. Earlier this month I finished the latest set of “pre-qual’s” for Microsoft and upgraded my Partnership status for myself and helped one of my technicians do the same. I’m loving some of the new benefits. I ended my last class for college on the 20th with an A and started two new classes on the 22nd and typical me; I’m fucking up left and right in one class and doing ok in the other. I think this is going to be the first class I’m in where I’ll actually be requesting the tutoring as opposed to tutoring everyone else.

On the 23rd I went to my normal back treatments and was having severe chest pains the entire drive down there. They were a little worried about hooking me up to all the equipment and I don’t blame them. Other than the pain in my chest I felt fine, but that shit just wouldn’t go away. Later that night I went to the hospital to get it checked out and they said it was stressed induced and gave me a shot of something to calm my ass down or relieve the stress, whatever… shit just made me loopy for like an hour but the pain went away shortly after, so that’s good.

I’ve finished installing and configuring the 2 new servers for my house and upgraded the rest of my computers to Windows 7 Professional (Win7 Ultimate on my main laptop). I still have some other ‘roles’ I want to add to the main server (like WDS and WSUS to name a few) but I’m going to wait until I can get my grades up in my one class without the other suffering so that it will help me overall with the stress.

Near the end of next month I’ll most likely be heading to New York City for a day or two for a couple conferences, I hope my college schedule works out so I don’t miss much there. It’ll be kind of nice and act like a mini vacation as well, so that’s good.

I have to attempt to take a power nap now since I have back treatments later today and have 2 classes tonight, so I’m going to start taking notes on one of the multiple devices I normally have with me so that I can keep my head straight since I’m stressed/preoccupied with thoughts of class and don’t remember the rest of the things I was going to put (yet again). There were a few things I do remember, but I don’t have the time to deal with writing those now, so I already took notes of those.

Wave Hello Later