Using VirtuaWinPortable -- but, want to keep multiple .cfg files for different purposes. These scripts help:
Copy_to_Cfg.vbs ~ http://www.box.com/s/65cf64a8877b6fd24873
Cfg_to_Copy.vbs ~ http://www.box.com/s/4719ecb4102f48a78c65
Sample use ~ http://www.box.com/s/6bae0d77b2c4f77aca5b
Showing posts with label _FileProcessing. Show all posts
Showing posts with label _FileProcessing. Show all posts
4.21.2012
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
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
Subscribe to:
Posts (Atom)