1.27.2012

NPPCompare.VBS

'-
Dim aaaNPPCompare _
, oArgs _
, oFs _
, oSh _
, sDir2 _
, sMsg _
, zzzNPPCompare

Sub Help()
    sMsg = _
    " This uses Notepad++ to compare two files.  Assumptions:               " & vbLF & _
    " #1 Notepad++ is installed                                             " & vbLF & _
    " #2 'Compare' plug-in is active, e.g., if Plugins/Compare              " & vbLF & _
    "     doesn't show up -- activate by:                                   " & vbLF & _
    "     Plugins/Plugin Manager/Show Plugin Manager ... check 'Compare'.   "
    Msgbox sMsg,vbOkOnly,WScript.Scriptname
End Sub
'-
Sub QExit
    Set oSh=Nothing
    Set oFS=Nothing
    WScript.Quit
End Sub
'-

Set oSh=CreateObject("WScript.Shell")
Set oFS=CreateObject("Scripting.FileSystemObject")

If Not oFS.FileExists("C:\Program Files\Notepad++\notepad++.exe") Then
    Help
    QExit
End If
'-
Sub ccSleep(seconds)
  cmd = "%COMSPEC% /c ping -n " & _
    1 + seconds & " 127.0.0.1>nul"
  oSh.Run cmd,0,1
End Sub
'-
Set oArgs = WScript.Arguments
If oArgs.Count = 2 Then
  sDir2=Split(oArgs.Item(1),"\")
  oSh.Run _
    chr(34) & "c:\Program Files\" & _
              "Notepad++\" & _
              "notepad++.exe" & chr(34) & " " & _
      chr(34) & oArgs.Item(0) & chr(34) & _
        "," & _
      chr(34) & oArgs.Item(1) & chr(34)
    While Not _
      oSh.AppActivate(sDir2(UBound(sDir2)) & _
        " - Notepad++")
      ccSleep 1
    Wend
    oSh.AppActivate(sDir2(UBound(sDir2)) & _
      " - Notepad++")
    oSh.SendKeys "%P{Enter 2}"
End If

Set oSh=Nothing
Set oFS=Nothing

WScript.Quit

xlsx_to_vbs.VBS

Dim aaaXLSX_to_CSV _
, bDebug _
, oFS _
, oSh _
, sCSV _
, sDir _
, sFullName _
, sMsg _
, sXLSX _
, zzzXLSX_to_CSV
'-
Sub Help()
Dim vResult
sMsg = _
"Assumes:" & vbLF & _
"- an XLSX with a single tab" & vbLF & _
"- sheet expands to full window."
vResult=oSh.Popup _
(sMsg, _
7, _
WScript.ScriptName, _
vbYesNo+vbDefaultButton2)
If vResult<>vbYes Then
Set oSh=Nothing
Set oFS=Nothing
WScript.Quit
End If
End Sub
'-
Sub ccSleep(seconds)
cmd = "%COMSPEC% /c ping -n " & _
1 + seconds & " 127.0.0.1>nul"
oSh.Run cmd,0,1
End Sub
'-
Sub XLS_to_CSV(sFullName)
sDir=Split(sFullName, "\")
sXLSX=chr(34) & sFullName & chr(34)
If bDebug Then msgbox "sXLSX[" & sXLSX & "]"
sCSV= _
chr(34) & replace(sFullName,".xlsx",".csv") & chr(34)
If bDebug Then msgbox "sCSV[" & sCSV & "]"
oSh.Run "excel " & sXLSX
While Not _
oSh.AppActivate _
("Microsoft Excel - " & sDir(UBound(sDir)) )
ccSleep 1
Wend

oSh.AppActivate _
("Microsoft Excel - " & sDir(UBound(sDir)) )

On Error Resume Next
oFS.DeleteFile replace(sCSV,chr(34),"")

oSh.Sendkeys "%(FA){Tab}c{enter 3}"
While Not _
oSh.AppActivate _
("Microsoft Excel - " & _
Replace(sDir(UBound(sDir)),".xlsx",".csv") )
ccSleep 1
Wend

oSh.AppActivate _
("Microsoft Excel - " & _
Replace(sDir(UBound(sDir)),".xlsx",".csv") )
oSh.Sendkeys "%{F4}"
ccSleep 1
oSh.SendKeys "N"
End Sub
'-
' Main
'bDebug=vbTrue
Set oSh=CreateObject("WScript.Shell")
Set oFS=CreateObject("Scripting.FileSystemObject")
'
Help
'
For Each sFullName in WScript.Arguments
XLS_to_CSV sFullName
Next
'
Set oFS = Nothing
Set oSh = Nothing

WScript.Quit

1.21.2012

Created a 'SAY' command using AutoIt

Refreshing my Perl knowledge. Wanted to copy/paste examples and make them self-documenting (audio wise). Thought pre-pending text with 'SAY' and using this AutoIt script would work:

Dim $oSPV,$i,$msg,$speak_msg
$oSPV=ObjCreate("SAPI.spVoice")
For $i=1 to $cmdline[0]
$msg=$msg & ' ' & $cmdline[$i]
Next
$speak_msg=$msg
$speak_msg=stringreplace($speak_msg,'#',' ')
$speak_msg=stringreplace($speak_msg,'#',' ')
ConsoleWrite('REM ' & $msg & @lf)
$oSPV.Speak($speak_msg)

say.au3
say.exe

1.03.2012

myTTS/PROCQUIT - to speak selected text (in most any app)

Uses SAPI to play back highlighted text in an app.

Download myTTS.exe:
http://www.box.com/s/5xrya4nqu4cslzjlb000
 



If you wish to stop a long running ~ speaking text, download myPROCQUIT to same folder.
Press 'Escape' to quit the TTS applet.

Download myPROCQUIT:
http://www.box.com/s/kx2e576zmksltjspstnr