Sign in to follow this  
Followers 0

Get Console Process

9 posts in this topic

Posted (edited)

how can I get the progress in console ----- the number of the points ?

sorry for title

Edited by netegg

Share this post


Link to post
Share on other sites



Posted

To get any info from a console you would need to be reading the stdout stream of it. Use StdoutRead().

Share this post


Link to post
Share on other sites

Posted (edited)

i got it!

Func _Console_ReadConsoleOutputCharacter($hConsoleOutput, $nNumberOfCharsToRead, $iX, $iY, $fUnicode = Default, $hDll = -1)
	Local $tCoord, $tBuffer, $aResult,
	If $fUnicode = Default Then $fUnicode = $__gfUnicode
	If $hDll = -1 Then $hDll = DllOpen("kernel32.dll")
	If $hConsoleOutput = -1 Then $hConsoleOutput = _Console_GetStdHandle($STD_OUTPUT_HANDLE, $hDll)
	$tCoord = BitShift($iY, -16) + $iX
	If $fUnicode Then
		$tBuffer = DllStructCreate("wchar[" & ($nNumberOfCharsToRead + 1) & "]")
		$aResult = DllCall($hDll, "bool", "ReadConsoleOutputCharacterW", _
				"handle", $hConsoleOutput, _
				"ptr", DllStructGetPtr($tBuffer), _
				"dword", $nNumberOfCharsToRead, _
				"dword", $tCoord, _
				"dword*", 0)
	Else
		$tBuffer = DllStructCreate("char[" & ($nNumberOfCharsToRead + 1) & "]")
		$aResult = DllCall($hDll, "bool", "ReadConsoleOutputCharacterA", _
				"handle", $hConsoleOutput, _
				"ptr", DllStructGetPtr($tBuffer), _
				"dword", $nNumberOfCharsToRead, _
				"dword", $tCoord, _
				"dword*", 0)
	EndIf
	If @error Or (Not $aResult[0]) Then Return SetError(@error, @extended, "")
	Return SetExtended($aResult[4], DllStructGetData($tBuffer, 1))
EndFunc   ;==>_Console_ReadConsoleOutputCharacter
Edited by netegg

Share this post


Link to post
Share on other sites

Posted

Wasn't expecting that. Nice function :)

Share this post


Link to post
Share on other sites

Posted

netegg,

Next time when you post code please post a link to where you got it from because you're going to cause problems in the future, for example 'netegg why doesn't the code work and where can I find the variable $__gfUnicode?'

by Mat and you need his Console.au3 UDF.

Share this post


Link to post
Share on other sites

Posted

netegg,

Next time when you post code please post a link to where you got it from because you're going to cause problems in the future, for example 'netegg why doesn't the code work and where can I find the variable $__gfUnicode?'

by Mat and you need his Console.au3 UDF.

Sorry! I remember!

Share this post


Link to post
Share on other sites

Posted

OK, thanks.

Share this post


Link to post
Share on other sites

Posted

Thought that was strange.. :)

Nice function Mat.

Share this post


Link to post
Share on other sites

Posted

@netegg

can you post your solution for DISM?

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.