Get Line and Column numbers of a Notepad window? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
omareg94
Posts: 94
Joined: 27 Jun 2016, 22:46

Get Line and Column numbers of a Notepad window?

Post by omareg94 » 26 Apr 2020, 03:24

Hello,

How can I get Line and Column numbers of a Notepad window?

Image

Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: Get Line and Column numbers of a Notepad window?  Topic is solved

Post by Odlanir » 26 Apr 2020, 03:40

This works for me in Win10:

Code: Select all

StatusBarGetText, StatusText, 2, ahk_class Notepad
MsgBox, % StatusText
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode

omareg94
Posts: 94
Joined: 27 Jun 2016, 22:46

Re: Get Line and Column numbers of a Notepad window?

Post by omareg94 » 26 Apr 2020, 04:21

Thanks this gets it successfully.

Code: Select all

2::
  WinGet, window_id, ID, A
  StatusBarGetText, StatusText, 2, ahk_id %window_id%
  RegExMatch(StatusText, "(?<=Ln )\d*", line_number)
  RegExMatch(StatusText, "(?<=Col )\d*", column_number)
  MsgBox, % "line number: " line_number "`ncolumn number: " column_number
return

Post Reply

Return to “Ask for Help (v1)”