Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

How to get current cursor position on Windows command prompt

by tarunmudgal4u (Sexton)
on Sep 30, 2013 at 06:48 UTC ( #1056292=perlquestion: print w/replies, xml ) Need Help??
tarunmudgal4u has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I'm working on a script wherein I want to check the current cursor position on the console whether it's at the beginning of the line or somewhere in between.

I tried using tell function but it returns total bytes rather coordinates. If I can get cursor coordinates somehow, I would be able to check the x coordinate and confirm if cursor it at the beginning of the line or not.

Please let me know your suggestions on this

  • Comment on How to get current cursor position on Windows command prompt

Replies are listed 'Best First'.
Re: How to get current cursor position on Windows command prompt
by davido (Archbishop) on Sep 30, 2013 at 06:58 UTC

    Win32::Console: ($x, $y, $size, $visible) = $CONSOLE->Cursor();. I don't use Windows much anymore, but the module looks very useful for 1980's style user interfaces. ;)


    Dave

Re: How to get current cursor position on Windows command prompt
by Marshall (Abbot) on Sep 30, 2013 at 08:19 UTC
    I ask what application you are trying to accomplish?

    Can you describe this more?

    A normal command prompt application allows you to edit the input (backspace or insert/delete) and then hit "return" and the command executes.

    The normal idea of a command line is that you edit the command and then "hit enter". What is what you want different than that?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1056292]
Approved by Corion
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2017-03-23 01:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (278 votes). Check out past polls.