Progressive Internet Solutions
In: ACLU of Arkansas| Projects
29 Jun 2009
In doing some work for the ACLU of Arkansas, I needed to convert some colors, and was flummoxed when I couldn’t find a good converter that would to Pantone to RGB and HEX values. Wolfram Alpha, being a computation engine, should find this right up its alley. It’s the first feature request I’ve submitted to the site, and they promise “[...] to respond to as many suggestions and comments as possible,
and to implement good suggestions we are given.”
I think it’s a good suggestion; what do you think? Here’s what I sent:
Read the rest of this entry »
In: MidSOUTH
17 Jun 2009Say you have a script—like the previous CIM Repository Listing script—that outputs hundreds of rows of text via WScript.Echo. On the command line, this is fine; the text will go scrolling by, and can be piped to the more command or grep (yes, really), or logged to a file. But if you make the mistake of executing a script like this by double-clicking, you’ll get modal popup messages that prevent the rest of the script from running until you hit “OK” for each line.
You could change the default scripting environment to always be the command line:
CScript //H:CScript //NoLogo //S
But then you have to treat the GUI-based scripts differently, and launch them from the command line with wscript. Oh, bother.
It’s always been possible to just go ahead and launch vbscripts from the command line with the cscript command, but having to open a command prompt and type out the path to the script every time is a pain. Why not have the script auto-detect how it was launched, and if it wasn’t launched from the command line, relaunch itself correctly? Well, Tek-Tips user tsuji has figured out how to do it.
By including this subroutine in your VBScript and putting a call to it at the top of the script, it will do just that.
The edits to this script from tsuji’s version are that instead of keeping the command window open after execution with the “/k” switch, I continue to use the “/c” (close command after completion) but chain the “pause” command at the end of the command. This is a little-known (in the DOS/Windows world, anyway) way of doing multiple things at once:
command1 && command2On *NIX, this will execute command2 after command1 completes, if it completes successfully (return code 0). On Windows, however, command2 will always be run, no matter the outcome of command1.
Sub force_cmdline Dim args : args="" Dim i, wshshell If right(lCase(wscript.fullname),11)= "wscript.exe" then For i=0 to wscript.arguments.count-1 args = args & wscript.arguments(i) & " " Next Set wshshell = createobject("wscript.shell") wshshell.Run wshshell.ExpandEnvironmentStrings("%comspec%") & " /c cscript.exe //nologo """ & wscript.scriptfullname & """" & args & " && pause" set wshshell = Nothing WScript.Quit End If End Sub
In: MidSOUTH
15 Jun 2009When starting to troubleshoot a Windows Server problem, the best place to look is the Windows Management Instrumentation (WMI); this little enclave of information—on every Windows machine—acts like a datastore representing the configuration of every nook and cranny of a system. But knowing what to look for is half the battle.
Recently, I was faced with diagnosing slow replication times for Branch Office Distributed File System Replication under Windows Server 2003. I had no idea where to look, so I referenced the following script, pointed the two instances of strComputer to our DFS-enabled file server, and looked for DFS-specific properties and methods:
cscript "List Win32 Providers.vbs" | grep -i dfs
This gave me the performance counters I could use to monitor performance, as well as how to programmatically create DFS shares and namespaces.
strComputer = "." Set objWMIService=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") For Each objclass in objWMIService.SubclassesOf() intCounter=0 If Left(objClass.Path_.Class,5) = "Win32" Then For Each Qualifier in objClass.Qualifiers_ If UCase(Trim(Qualifier.Name)) = "ASSOCIATION" Then intCounter = 1 End If Next If x = 0 Then strComputer = "." Set objWMIService = GetObject _ ("winmgmts:{impersonationLevel=impersonate}!\\" & _ strComputer & "\root\cimv2") Set strClass = objWMIService.Get(objClass.Path_.Class) Wscript.Echo "PROPERTIES:" For each strItem in strClass.properties_ Wscript.Echo objClass.Path_.Class & vbTab & strItem.name Next Wscript.Echo "METHODS:" For Each strItem in strClass.methods_ Wscript.Echo objClass.Path_.Class & vbTab & strItem.name Next End If End If Next
In: Conversation
11 Jun 2009Welcome to the new Savory Ape blog!
I’m Chris Hota, founder of Savory Ape Services. When I started Savory Ape, I envisioned it as an umbrella company for community-positive activities, especially those areas where local business and community come together. On this blog, I’m going to chronicle the different projects Savory Ape working on, some solutions we’ve come up with, and hopefully learn together what’s needed to bring those parts of Little Rock lagging behind into the information age.