Jump to content

pulling up a similar but wrong field


gcue
 Share

Recommended Posts

i am trying to get the value of "Login Time:" not "Last Login Time:"

cant seem to get it

(?s)[^Last](Login Time: )[^\v]+

Last Login Time: 07:22:03 pm 03/10/10

Account Locked: False

Account Disabled: False

Grace Logins Allowed: 3

Remaining Grace Logins: 3

Last Intruder Address:

TCP/IP Network Address

IP Address: 30.20.222.74

Maximum Connections: 6

Login Script:

map k:=lao-nws_user_server\users2:

@NET USE x: \\loap01\teams

Login Time: 05:09:48 am 03/11/10

modifiersName: CN=CGNDSDR

Edited by gcue
Link to comment
Share on other sites

$string = _
'Last Login Time: 07:22:03 pm 03/10/10' & @CRLF & _
'Account Locked: False' & @CRLF & _
'Account Disabled: False' & @CRLF & _
'Grace Logins Allowed: 3' & @CRLF & _
'Remaining Grace Logins: 3' & @CRLF & _
'Last Intruder Address:' & @CRLF & _
'TCP/IP Network Address' & @CRLF & _
'IP Address: 30.20.222.74' & @CRLF & _
'Maximum Connections: 6' & @CRLF & _
'Login Script:' & @CRLF & _
'map k:=lao-nws_user_server\users2:' & @CRLF & _
'' & @CRLF & _
'@NET USE x: \\loap01\teams' & @CRLF & _
'Login Time: 05:09:48 am 03/11/10' & @CRLF & _
'modifiersName: CN=CGNDSDR'

$result = StringRegExp($string, "(?m)^Login Time: (.+)",1)
If @ERROR Then MsgBox(0,"",@ERROR)

For $X = 0 to Ubound($result)-1
    ConsoleWrite($result[$X] & @CRLF)
Next

Link to comment
Share on other sites

you;re right i just see on how to match it not ignore it

If you copy all the AutoIt code in the post except the first character (usually #) then it pastes correctly so all you have to do is add the first character.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

not sure what you mean martin..

i also tried

"(\s)^Login Time: (.+)"

which also didn't work - no results

I was talking about copying and pasting the AutoIt code from Weaponex's post!

Try this line

$result = StringRegExp($string, "(?m)^Login Time: (.+)[^\n\r]",1)
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

still doesnt work =/

i did a consolewrite for the $string

(dunno if a consolewrite indicates the right spacing or not)

its an output from a dos command which queries the server

appreciate the help!

Last Login Time: 05:09:48 am 03/11/10

Account Locked: False

Account Disabled: False

Grace Logins Allowed: 3

Remaining Grace Logins: 3

Last Intruder Address:

TCP/IP Network Address

IP Address: 30.20.222.74

Maximum Connections: 6

Login Script:

map k:=lo-nwcs_user_server\user:

@NET USE x: \\loap01\team

Login Time: 05:06:33 am 03/12/10

modifiersName: CN=CNDSDR1

Edited by gcue
Link to comment
Share on other sites

still doesnt work =/

i did a consolewrite for the $string

(dunno if a consolewrite indicates the right spacing or not)

its an output from a dos command which queries the server

appreciate the help!

Using the example in an earlier post there is no @CR or @LF in the result as this shows

$string = _
'Last Login Time: 07:22:03 pm 03/10/10' & @CRLF & _
'Account Locked: False' & @CRLF & _
'Account Disabled: False' & @CRLF & _
'Grace Logins Allowed: 3' & @CRLF & _
'Remaining Grace Logins: 3' & @CRLF & _
'Last Intruder Address:' & @CRLF & _
'TCP/IP Network Address' & @CRLF & _
'IP Address: 30.20.222.74' & @CRLF & _
'Maximum Connections: 6' & @CRLF & _
'Login Script:' & @CRLF & _
'map k:=lao-nws_user_server\users2:' & @CRLF & _
'' & @CRLF & _
'@NET USE x: \\loap01\teams' & @CRLF & _
'Login Time: 05:09:48 am 03/11/10' & @CRLF & _
'modifiersName: CN=CGNDSDR'

$result = StringRegExp($string, "(?m)^Login Time: (.+)[^\n\r]",1)
If @ERROR Then MsgBox(0,"",@ERROR)

For $X = 0 to Ubound($result)-1
    for $j = 1 to stringlen($result[$X])
        consolewrite(Hex(Asc(StringMid($result[$X],$j,1)),2) & ":");last character of string is "1" not @CR or @LF
    Next
    ConsoleWrite(@CRLF)
    ConsoleWrite($result[$X] & @CRLF)
Next
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

the entire output is seen as 1 whole line - not sure how the spacing falls into it - any way to show hidden characters? well they'd be whitespaces anyway - bah

at which case this would work right?

"(\s)^Login Time: (.+)"

no dice =/

Edited by gcue
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...