Jump to content

Question about _EventLog__Open() in non-english operating system


Guest
 Share

Go to solution Solved by Exit,

Recommended Posts

Hello,

Is this line will work also in non-english operating system:

Local $hEventLog = _EventLog__Open('', 'Application')

I'm just not sure it will work because I've seen that the windows event log can be in different language and  maybe the word 'Application' will not work in such a system.

I did not found any answer to my question in the help file..

I'd appreciate if anyone has an answer.

 

Thanks for helpers!

 

EDIT:

Sorry, I was supposed to write my question better.

When I said "Work" I mean to the case that the function was  succeeded to read the 'Application' category
.

Because maybe in other computers ( With a different language) the string 'Application' is not valid. In that case  I am afraid that the function will not read this category because it is looking for 'Application' where the correct string is 'приложений' (Application in russian according to Google Translate).

 

I need you to run this code:

#include <EventLog.au3>
#include <Array.au3>

Local $hEventLog = _EventLog__Open('', 'Application')
If $hEventLog = 0 Then
    ConsoleWrite('Error 1'&@CRLF)
    Exit
EndIf

Local $aEvent = _EventLog__Read($hEventLog, True, False) ; read last event
If Not $aEvent[0] Then
    ConsoleWrite('Error 2'&@CRLF)
    Exit
EndIf

ConsoleWrite('No Error'&@CRLF&@CRLF)
PrintEventData($aEvent)




Func PrintEventData($aEvent)
    ConsoleWrite("Result [0].........: " & $aEvent[0]&@CRLF)
    ConsoleWrite("Record number [1] .: " & $aEvent[1]&@CRLF)
    ConsoleWrite("Submitted [2] .....: " & $aEvent[2] & " " & $aEvent[3]&@CRLF)
    ConsoleWrite("Generated [4] .....: " & $aEvent[4] & " " & $aEvent[5]&@CRLF)
    ConsoleWrite("Event ID [6] ......: " & $aEvent[6]&@CRLF)
    ConsoleWrite("nType [7] .........: " & $aEvent[7]&@CRLF)
    ConsoleWrite("Type [8] ..........: " & $aEvent[8]&@CRLF)
    ConsoleWrite("Category [9] ......: " & $aEvent[9]&@CRLF)
    ConsoleWrite("Source [10] .......: " & $aEvent[10]&@CRLF)
    ConsoleWrite("Computer [11] .....: " & $aEvent[11]&@CRLF)
    ConsoleWrite("Username [12] .....: " & $aEvent[12]&@CRLF)
    ConsoleWrite("Description [13] ..: " &@CRLF&$aEvent[13]&@CRLF)
    ConsoleWrite(@CRLF & @CRLF & @CRLF)
EndFunc

In operating system where the language of the event log is not English

And tell me what you get.

Thanks!

Edited by Guest
Link to comment
Share on other sites

Line: @error-@extended: Line syntax
0001: 0-0: #AutoIt3Wrapper_Run_Debug_Mode=1
0002: 0-0: #include <EventLog.au3>
0003: 0-0: Local $hEventLog = _EventLog__Open("", "Application")
0004: 0-0: ConsoleWrite("German locale    Error: " & @error & " Extended: " & @extended& @LF)
German locale    Error: 0 Extended: 0
+>02:27:34 AutoIt3.exe ended.rc:0

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

Sorry, I was supposed to write my question better.

When I said "Work" I mean to the case that the function was  succeeded to read the 'Application' category
.

Because maybe in other computers ( With a different language) the string 'Application' is not valid. In that case  I am afraid that the function will not read this category because it is looking for 'Application' where the correct string is '@#&23x?##' (String in another language).

 

I need you to run this code:

#include <EventLog.au3>
#include <Array.au3>

Local $hEventLog = _EventLog__Open('', 'Application')
If $hEventLog = 0 Then
    ConsoleWrite('Error 1'&@CRLF)
    Exit
EndIf

Local $aEvent = _EventLog__Read($hEventLog, True, False) ; read last event
If Not $aEvent[0] Then
    ConsoleWrite('Error 2'&@CRLF)
    Exit
EndIf

ConsoleWrite('No Error'&@CRLF&@CRLF)
PrintEventData($aEvent)




Func PrintEventData($aEvent)
    ConsoleWrite("Result [0].........: " & $aEvent[0]&@CRLF)
    ConsoleWrite("Record number [1] .: " & $aEvent[1]&@CRLF)
    ConsoleWrite("Submitted [2] .....: " & $aEvent[2] & " " & $aEvent[3]&@CRLF)
    ConsoleWrite("Generated [4] .....: " & $aEvent[4] & " " & $aEvent[5]&@CRLF)
    ConsoleWrite("Event ID [6] ......: " & $aEvent[6]&@CRLF)
    ConsoleWrite("nType [7] .........: " & $aEvent[7]&@CRLF)
    ConsoleWrite("Type [8] ..........: " & $aEvent[8]&@CRLF)
    ConsoleWrite("Category [9] ......: " & $aEvent[9]&@CRLF)
    ConsoleWrite("Source [10] .......: " & $aEvent[10]&@CRLF)
    ConsoleWrite("Computer [11] .....: " & $aEvent[11]&@CRLF)
    ConsoleWrite("Username [12] .....: " & $aEvent[12]&@CRLF)
    ConsoleWrite("Description [13] ..: " &@CRLF&$aEvent[13]&@CRLF)
    ConsoleWrite(@CRLF & @CRLF & @CRLF)
EndFunc

In operating system where the language of the event log is not English

And tell me what you get.

Thanks!

Link to comment
Share on other sites

  • Solution

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
No Error

Result [0].........: True
Record number [1] .: 6766
Submitted [2] .....: 02/04/2015 11:42:14 AM
Generated [4] .....: 02/04/2015 11:42:14 AM
Event ID [6] ......: 10001
nType [7] .........: 4
Type [8] ..........: Information
Category [9] ......: 0
Source [10] .......: Microsoft-Windows-RestartManager
Computer [11] .....: Spider
Username [12] .....: Spider
Description [13] ..: 
Sitzung wird beendet: 0. 2015-02-04T10:41:40.719000000Z wird gestartet.

German environment

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...