Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript, CTRL-A, CTRL-C automation

Status
Not open for further replies.

jakepin

Technical User
Feb 9, 2014
2
GB
Hi All,
I am totally new to VBScript so please be gentle with me

So I have the following scenario that I wanted to automate:-
1. We use a third party software which produce log files which I need to review on an individual basis
2. I open the log file (on the third party software) - it opens as a text file
3. I do CRTL-A, CTRL-C to copy to clipboard
4. I save it into a file on my c drive called logdump.log
5. I refresh windows explorer to ensure I use the latest file
6. I run a ms dos script to check for key errors in the log and output this summary to a new text file

the following Vbscript I 'found' to do point 4. But wondered if someone could help me also to do points 3 and 5.
Set objHTML = CreateObject("htmlfile")
ClipboardText=objHTML.Parentwindow.ClipboardData.GetData("text")
path = "c:\temp\logdump.log"
set objFSO = CreateObject("Scripting.FilesystemObject")
Set objFile = objFSO.OpenTextFile(path, 2, true)
objFile.WriteLine ClipboardText
objFile.Close

Point 6 I do using an MS Dos script which works perfectly fine but it would be very helpful also as a bonus if you can show me how I could do the same in VBScript.
This is what I currently have

MS Dos (.dat file) contains the following (paste_me.vbs is the vbscript file above) which runs the vbscript, then creates an empty file called c:\temp\logdump.txt (clunky way), then uses the findstr to loop through and search for certain keywords, and outputs these to a summary, then it opens the summary.
@echo off
C:\windows\SysWow64\cmd.exe /c cscript \c:temp\paste_me.vbs
echo "logdump.log" > c:\temp\logdump.txt
findstr /i /c:"ERROR" /c:"WARNING" /c:"ERROR DETECTED" /c:"values have been converted" c:\temp\logdump.log >> c:\temp\logsummary.txt
c:\temp\logsummary.txt

FYI : I am not able to install any third party software on my PC.

I would appreciate any useful suggestions to any of the above questions and thank you in advance for your help.
Thanks,
Jake
 
They are on a piece of third party software but I am unable to 'extract' them in any other way than to do a CTRL-A, CTRL-C as the third party will not allow any other interaction or integrated software.
 
Are you allowed to mention the name of this 3rd party software?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top