NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page visual basic scripting - beginner question

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 03-06-2011, 08:42 PM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Mar 2009
Posts: 29
domainwealth is on a distinguished road
 



visual basic scripting - beginner question


hi all - i found a script that's doing exactly what i need but the only issue i have with is is the date format. the date format is just a string but not mm/dd/yyyy.

does anyone know what i would need to add in order to convert it to mm/dd/yyyy?

i'll post the script instead of the link. not sure if posting the link is against tos

really appreciate your help!!!


****************************************
' EventID12.vbs
' Version 1.9
' Guy Thomas 1st August 2010

Option Explicit

Dim objFso, objFolder, objWMI, objEvent ' Objects
Dim strFile, strComputer, strFolder, strFileName, strPath ' Strings
Dim intEvent, intNumberID, intRecordNum, colLoggedEvents

' --------------------------------------------
' Set your variables
intNumberID = 12 ' Event ID Number
intEvent = 1
intRecordNum = 1

strComputer = "."
strFileName = "\Event12.txt"
strFolder = "C:\GuyEbooks"
strPath = strFolder & strFileName

' ----------------------------------------
' Section to create folder to hold file.
Set objFso = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists(strFolder) Then
Set objFolder = objFSO.GetFolder(strFolder)
Else
Set objFolder = objFSO.CreateFolder(strFolder)
Wscript.Echo "Folder created " & strFolder
End If
Set strFile = objFso.CreateTextFile(strPath, True)

'--------------------------------------------
' Next section creates the file to store Events
' Then creates WMI connector to the Logs

Set objWMI = GetObject("winmgmts:" _
& strComputer & "\root\cimv2")
Set colLoggedEvents = objWMI.ExecQuery _
("Select * from Win32_NTLogEvent Where Logfile = 'System'" )

Wscript.Echo " Press OK and Wait 30 seconds (ish)"
' -----------------------------------------
????: NamePros.com http://www.namepros.com/programming/705524-visual-basic-scripting-beginner-question.html
' Next section loops through ID properties
intEvent = 1
For Each objEvent in colLoggedEvents
If objEvent.EventCode = intNumberID Then

strFile.WriteLine ("Record No: ")& intEvent
' strFile.WriteLine ("Category: " & objEvent.Category)
strFile.WriteLine ("Computer Name: " & objEvent.ComputerName)
strFile.WriteLine ("Event Code: " & objEvent.EventCode)
' strFile.WriteLine ("Message: " & objEvent.Message)
' strFile.WriteLine ("Record Number: " & objEvent.RecordNumber)
strFile.WriteLine ("Source Name: " & objEvent.SourceName)
' strFile.WriteLine ("Time Written: " & objEvent.TimeWritten)
strFile.WriteLine ("Event Type: " & objEvent.Type)
strFile.WriteLine ("User: " & objEvent.User)
strFile.WriteLine (" ")
intRecordNum = intRecordNum +1
End if
IntEvent = intEvent +1
Next
Wscript.Echo "Check " & strPath & " for " &intRecordNum & " events"

WScript.Quit

' End of Guy's Script
*****************************
__________________
For Sale: SpringformPans.net
domainwealth is offline   Reply With Quote
Old 03-09-2011, 08:51 AM   #2 (permalink)
NamePros Regular
 
sourcez's Avatar
Join Date: Nov 2007
Location: UK
Posts: 403
sourcez is a jewel in the roughsourcez is a jewel in the roughsourcez is a jewel in the rough
 



Unsure...but I'm going to post a link anyway!

This may help...
http://www.ms-news.net/f2891/turn-ob...e-3717967.html
__________________
3cc Internet
sourcez is offline   Reply With Quote
Old 03-18-2011, 06:21 AM   #3 (permalink)
NamePros Member
Join Date: Mar 2011
Posts: 47
jacobatwood is an unknown quantity at this point
 



I will find out the solution for this.
__________________
█ A home to Virtual Machines!
Onshore/Offshore Managed VPS
Managed HardCore Ultimate VPS Offshore/Onshore
jacobatwood is offline   Reply With Quote
Old 06-10-2011, 11:54 AM   #4 (permalink)
Senior Member
 
Expron's Avatar
Join Date: Sep 2007
Location: Chicago, IL USA
Posts: 682
Expron has much to be proud ofExpron has much to be proud ofExpron has much to be proud ofExpron has much to be proud ofExpron has much to be proud ofExpron has much to be proud ofExpron has much to be proud ofExpron has much to be proud ofExpron has much to be proud of
 


Animal Rescue
Not sure if a solution is needed, but this should do the trick:

' strFile.WriteLine ("Time Written: " & objEvent.TimeWritten)

strFile.WriteLine ("Time Written: " & Format$(Now, "mm/dd/yyyy")

Replacing this line will give you today's date format.
Expron is online now   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Question? Domains4u Programming 7 12-19-2005 12:43 PM
Question regarding basic web design sopiaz57 Web Design Discussion 12 02-25-2004 08:41 AM
Basic domain question rak147 Domain Newbies 5 02-16-2004 01:37 PM
Basic Question! bluey21 Web Design Discussion 3 02-16-2004 02:53 AM
Basic Question hektor911 Web Design Discussion 7 02-16-2004 02:46 AM

 
All times are GMT -7. The time now is 02:45 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger