Jump to content

How to find the cursor position (Line number) and move the cursor in SciTE


Recommended Posts

Hi all,

I would like to know how to find the cursor position (Line number) in SciTE and move cursor to a purticular line. I saw the "_WinAPI_GetCursorInfo" function and "_WinAPI_GetCursor" function in help file. But first fuction is giving the x,y cordinates of cursor. I need the line number which cursor resides. Second function gives the handle of cursor. I don't know what to do with cursor handle. Please help me.

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

  • Developers

Not sure what exactly you are looking for. Is this something to automate through AutoIt3?

Manually: In the left-bottom of the SciTE window you find the currentline and Ctrl+G will bring up a Goto window.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hi 

Jos, i need to move the cursor automatically to a particular line. I saw, in the bottom of SciTE. there is line number.  My script can acces it this way;

 
Local $title = WinGetTitle("[CLASS:SciTE]")
WinActivate($title )
Local $TitleText = WinGetText($title ) 
Local $ar = StringSplit($TitleText , @CR) 
Local $LastIndex = UBound($ar) 
Local $LastItem = $ar[$LastIndex -1]

But i need to goto a particular line automatically. 

Edited by kcvinu
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

  • Developers

So how would you need to trigger the "go to line" event?

With a shortcut in SciTE or with a running AutoIt3 script?

EDIT: this is an example with an AutoIt3 script using the Director interface:

Opt("WinSearchChildren", 1)
Global $WM_COPYDATA = 74
; Get SciTE DirectorHandle
$Scite_hwnd = WinGetHandle("DirectorExtension")
; Get My GUI Handle
Global $My_Hwnd = GUICreate("AutoIt3-SciTE interface")
;
; goto the specified Line column
$line = 24
$Column = 15
SendSciTE_Command($My_Hwnd, $Scite_hwnd, "goto:" & $Line & "," & $Column) 
Exit
;
; Send command to SciTE
Func SendSciTE_Command($My_Hwnd, $Scite_hwnd, $sCmd)
    Local $My_Dec_Hwnd = Dec(StringRight($My_Hwnd, 8))
    $sCmd = ":" & $My_Dec_Hwnd & ":" & $sCmd
    ConsoleWrite('-->' & $sCmd & @LF)
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _
            'Ptr', DllStructGetPtr($COPYDATA))
EndFunc   ;==>SendSciTE_Command

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

So how would you need to trigger the "go to line" event?

With a shortcut in SciTE or with a running AutoIt3 script?

With a running AutoIt3 script. I have made a tool to insert "#include <your file name.au3>" in SciTE. But one member of this forum said to me that you need to paste the code where all other include lines starts. If there is not any includes, then you need to paste the code in first line. So i have made another function to find out which is the line number where "#include" starts. And if i find the number, i need to goto the line. I think i have made it clear now.

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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