Jump to content

Recommended Posts

Posted (edited)

Thanks for the information. Glad to hear you found the problem.

I want to understand - "localized strings" means that the strings "SERVICE_NAME" and "DISPLAY_NAME" are called in another language in your system?

I need to be sure i understood it correct.

 

right.

I changed this line

$aResult = StringRegExp($sResult, "(?mi)^(?:SERVICE_NAME|DISPLAY_NAME):\h*(\N+)", 3)

in this line (italian locale)

$aResult = StringRegExp($sResult, "(?mi)^(?:NOME_SERVIZIO|NOME_VISUALIZZATO):\h*(\N+)", 3)

..... if you want to distribute your scripts  all around the world, then you have to consider this situations....... :)

Edited by PincoPanco

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

right.

I changed this line

$aResult = StringRegExp($sResult, "(?mi)^(?:SERVICE_NAME|DISPLAY_NAME):\h*(\N+)", 3)

in this line (italian locale)

$aResult = StringRegExp($sResult, "(?mi)^(?:NOME_SERVIZIO|NOME_VISUALIZZATO):\h*(\N+)", 3)

..... if you want to distribute your scripts  world wide, then you have to consider this situations....... :)

Thank you very much!

I will continue with this information on another day.

Posted (edited)

right.

I changed this line

$aResult = StringRegExp($sResult, "(?mi)^(?:SERVICE_NAME|DISPLAY_NAME):\h*(\N+)", 3)

in this line (italian locale)

$aResult = StringRegExp($sResult, "(?mi)^(?:NOME_SERVIZIO|NOME_VISUALIZZATO):\h*(\N+)", 3)

..... if you want to distribute your scripts  all around the world, then you have to consider this situations....... :)

Thanks for the information.

Today I worked on it again.

Please check if this code works for you:

#include <Array.au3>



$timer = TimerInit()
$Services = _RetrieveRunningServices3()
ConsoleWrite("Time: "&TimerDiff($timer)&@CRLF)
_ArrayDisplay($Services)


Func _RetrieveRunningServices3($Sort = 0)
    Local $Output[1][2] , $iPid
    $Output[0][0] = 0
    $iPid = Run(@ComSpec & " /c sc query", @SystemDir, @SW_HIDE, 2)
    If $iPid > 0 Then
        ProcessWaitClose($iPid)
        Local $StdoutRead = StdoutRead($iPid)
        If Not @error Then
            Local $add = 0 , $n = 1 , $sername , $dispname , $aStdoutRead , $tmp
            $aStdoutRead = StringSplit($StdoutRead,@CRLF,1)
            For $a = 1 To $aStdoutRead[0]
                $tmp = StringLeft($aStdoutRead[$a],1)
                If $tmp <> " " And $tmp <> "" Then
                    $tmp = StringSplit($aStdoutRead[$a],": ",1)
                    If $tmp[0] = 2 Then
                        If $add = 0 Then
                            ReDim $Output[$n+1][2]
                            $Output[$n][0] = $tmp[$tmp[0]]
                            $add = 1
                        Else
                            $Output[$n][1] = $tmp[$tmp[0]]
                            $Output[0][0] = $n
                            $n += 1
                            $add = 0
                        EndIf
                    EndIf
                EndIf
            Next
            If $Sort = 1 And $Output[0][0] > 0 Then _ArraySort($Output, 0, 1, 0, 1) ; Sort by DisplayName
        EndIf
    EndIf
    ;$Output[0][0]
    Return $Output
EndFunc
Edited by Guest
Posted

 

Thanks for the information.

Today I worked on it again.

Please check if this code works for you:

#include <Array.au3>



$timer = TimerInit()
$Services = _RetrieveRunningServices3()
ConsoleWrite("Time: "&TimerDiff($timer)&@CRLF)
_ArrayDisplay($Services)


Func _RetrieveRunningServices3($Sort = 0)
    Local $Output[1][2] , $iPid
    $Output[0][0] = 0
    $iPid = Run(@ComSpec & " /c sc query", @SystemDir, @SW_HIDE, 2)
    If $iPid > 0 Then
        ProcessWaitClose($iPid)
        Local $StdoutRead = StdoutRead($iPid)
        If Not @error Then
            Local $add = 0 , $n = 1 , $sername , $dispname , $aStdoutRead , $tmp
            $aStdoutRead = StringSplit($StdoutRead,@CRLF,1)
            For $a = 1 To $aStdoutRead[0]
                $tmp = StringLeft($aStdoutRead[$a],1)
                If $tmp <> " " And $tmp <> "" Then
                    $tmp = StringSplit($aStdoutRead[$a],": ",1)
                    If $tmp[0] = 2 Then
                        If $add = 0 Then
                            ReDim $Output[$n+1][2]
                            $Output[$n][0] = $tmp[$tmp[0]]
                            $add = 1
                        Else
                            $Output[$n][1] = $tmp[$tmp[0]]
                            $Output[0][0] = $n
                            $n += 1
                            $add = 0
                        EndIf
                    EndIf
                EndIf
            Next
            If $Sort = 1 And $Output[0][0] > 0 Then _ArraySort($Output, 0, 1, 0, 1) ; Sort by DisplayName
        EndIf
    EndIf
    ;$Output[0][0]
    Return $Output
EndFunc

 

it worked fine

well done! :)

bye

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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
  • Recently Browsing   0 members

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