Page 1 of 1 1
Topic Options
#74354 - 2003-04-08 03:00 PM Utility: Get cursor and console information
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
First off let me say that I have no idea which forum this should be in so I'm posting here as it is mainly in response to this post.

SCRNDUMP.EXE
  • Do you need to read the data on the console?
  • Do you need to check the console height, or width?
  • Do you need to get the cursors current position?
You do? Well then look no further, scrndump.exe is the answer to your problems.
This small utility which you can download from here will do all these things for you.

If you call the executable with no parameters, it will dump the contents of the current console to a file in a format which can be CALLed by a KiXtart script. You may specify a file name if you don't want to use the default "scrndump.kix"

If you only want to know the cursor position use:
code:
scrndump.exe -cursor

The position is returned as an error level.
You can get the console size by running:
code:
scrndump.exe -size

The numbers are encoded as (X*1000)+Y and (Width*1000)+Height respectively.

Here is a simple example of how you would use it to determine the cursor location after an arbitrarty DOS command has been run:
Global $iX,$iY                  ; Declare global variables

Shell "scrndump.exe -size" ; Get the console size
udfTranslateCoord(@ERROR) ; Translate the coordinates
"Console width=" $iX ?
"Console height=" $iY ?

Shell "dir" ; Run a DOS command
Shell "scrndump.exe -cursor" ; Get the Cursor position
udfTranslateCoord(@ERROR) ; Translate the coordinates
?
"Cursor X coord=" $iX ?
"Cusror Y coord=" $iY ?

Function udfTranslateCoord($iCoord)
$iX=$iCoord mod 1000
$iY=($iCoord-$iX)/1000
EndFunction

The output would be:
quote:

G:\dev\scrndump>kix32 demo.kix
Console width=50
Console height=80
Makefile demo.kix scrndump.c scrndump.exe scrndump.kix

Cursor X coord=5
Cusror Y coord=0

Actually, I may have X and Y the wrong way round [Roll Eyes] but you get the idea.

Top
#204280 - 2012-02-12 01:25 AM Re: Utility: Get cursor and console information [Re: Richard H.]
marvince Offline
Fresh Scripter

Registered: 2006-05-16
Posts: 19
Loc: Northern Hemisphere
Hi, I tried to download scrndump.exe in order to use your KIX example, but the link seems broken?! I did a quick google search on scrndump.exe but I found nothing good so far. Is scrndump.exe outdated or replaced by something else?
Top
#204281 - 2012-02-12 06:41 AM Re: Utility: Get cursor and console information [Re: marvince]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
Surprisingly enough... I found it here:

http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=202866#Post202866

Top
#204282 - 2012-02-12 03:16 PM Re: Utility: Get cursor and console information [Re: Allen]
marvince Offline
Fresh Scripter

Registered: 2006-05-16
Posts: 19
Loc: Northern Hemisphere
Ah! I did a search in the forums for scrndump.exe, maybe I should have tried just the word "scrndump" instead \:\)
Thank you very much for the script Richard, and for your help Allen!


Edited by marvince (2012-02-12 03:21 PM)

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 323 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.051 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org