Jump to content

SciTE, LUA and DClick a Console line for goto(Li,Co)


Recommended Posts

In the console under the editor in SciTE: 
if I add @@ Debug(line,column) then it goes there.
if I add "script.au3" (line,column) then it goes there if loaded.
if I add "c:\path\script.au3" (line,column) then it loads the file and goes there.
...so far so good.

Since I don't know LUA, nor where that is at, my question is ... where is it at ?
A silly question because once there I would not know what to do, since I don't know LUA.

What I want to achieve is, that since there is something delimiting the script and editor position (li,co), a way to have, let's say:
+I like this color and the text that I care for on the left ["c:\path\script.au3" (line,column)]
and by having this ["" ()] format ( or anything else, it don't have to be this exact format ), the console would know to jump there.

If DClick to jump/goto Line,Column can trigger an external EXE or script, I'd take it from there. If it all can be done from LUA then, I'd do it there.
So I don't mind or know how. I just would like that functionality. In a way that don't require a recompile of SciTE.

Thanks :) 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

I don't know if is the executable identifying the pattern ""() or a lua script, that on DClick reads the line, parse the line to extract the "file"",line","column".
I wanted the functionality, so to have it I can: ... not much.

I could code a script.au3 that does something in double-click.
From there if the DClick is in the console read the line and send the command for SciTE to go there, if it matches this pattern.
( ... a fantastic brain storm )

Or ask you ;) 

So, that is in SciTE.exe and is not a LUA script. And, there is no way to have anything trigger anything ... because that is done internally, in the EXE.

hmm, ok I guess. Now ...do you: 1) understand the idea ?, and 2) like the idea/concept ?

:) ( secretly using emoji power to influence you into 1)yes, 2) yes ) :) 

Edited by argumentum
got the script going

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

ok, got the script.au3 going. It finds that it DoubleClicked the "Scintilla2".
Would you tell me the commands to use to ask for the text on the line at cursor in Scintilla2/Console ?
I'm using the SciTE func. from AutoIt3Wrapper.

Thanks

SciTE_ExternalGotoPos.au3

Edited by argumentum
added the code so far

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • Developers

I don't have the option to have a closer look at this today, maybe tomorrow when I have my LT available again.

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

  • Developers

How exactly does the line look you like to be detected as "error/warning" and be able to double click?
Maybe you can post a short script that simulates/writes a similar error message to the console, so I can use that to test?

 

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

ConsoleWrite('+++ Is not for warnings or errors ' & @TAB  & @TAB & '["' & @ScriptName &'"(' & @ScriptLineNumber & ')]' & @CRLF)
ConsoleWrite('- but rather for regular ConsoleWrite() ["UDF_' & @ScriptName &'"(' & @ScriptLineNumber & ')]' & @CRLF)
ConsoleWrite('> were by double clicking the line ["Other_' & @ScriptName &'"(' & @ScriptLineNumber & ')]' & @CRLF)
ConsoleWrite('+ it just goes there or loads the file if  ["Other_' & @ScriptName &'"(' & @ScriptLineNumber & ')]' & @CRLF)
ConsoleWrite('! the file is in the path AutoIt3/SciTE would expect.   {"InThePath.au3"(' & @ScriptLineNumber & ')}' & @CRLF)
ConsoleWrite('=== The notion of [""()] is good, or {""()}. Something to make it clear that is apropos,' & @CRLF)
ConsoleWrite('and not confuse it with an unintended string.' & @CRLF)

I believe that SciTE does it's magic before color assignation, as it is thought to be used in case of error.
But I want to use it "at will", anywhere. If the match is on the right most part of the string, is to be considered as a goto declaration.
The search of the file in the path is a shorten declaration ( just the filename.ext ), giving flexibility to its application at the expense of having to search for it, but "Alt-i" already does this to load the the #include file. Tho to assure a flawless finding, a FullPath should be permitted.
The extra mile: AutoIt3/SciTE usual path are searched but also search within paths declared in the #includes of the first/main script can be done but not to it's children/includes, as it would otherwise be like going thru a rabbit hole.

That is what I envision :) 

PS: actually the ticket for @IncludeScriptFullPath and @IncludeScriptName, was in great part for this purpose.

PS2: me obsessive ?, nahhh. lol. Got the DClicked text :)  ( but it'll be a 1000 times better as part of SciTE.exe )

Spoiler
Func DoTheSciteStuff()
    Local $hScintilla2 = ControlGetHandle($g_WinActiveInfo[0], "", "Scintilla2")
    Local $t = TimerInit(), $Gh = ""
    $Gh = Sci_GetCurrentTextLine($hScintilla2)
    ToolTip('Timer: ' & Round(TimerDiff($t)) & ' ms.'& @CR & '>' & StringStripWS($Gh, 3) & '<')
EndFunc   ;==>DoTheSciteStuff

Func Sci_GetCurrentTextLine($hScintilla2)
    Local $iPos, $sTextLine = "", $iCurrentLine  = Sci_GetCurrentLine($hScintilla2) ; current line
    Local $SCI_SETSELECTIONSTART=2142, $SCI_SETSELECTIONEND=2144, $iPos = @extended
    _SendMessage($hScintilla2, $SCI_SETSELECTIONSTART, $iPos, 0) ; clear the DClick selection
    _SendMessage($hScintilla2, $SCI_SETSELECTIONEND, $iPos, 0)
    Local $iLineStartPos = SCI_GetLineStartPos($hScintilla2, $iCurrentLine) ; first char of line
    Local $iLineEndPos = Sci_GetLineEndPos($hScintilla2, $iCurrentLine) ; last char of line
    For $iPos = $iLineStartPos To $iLineEndPos
        $sTextLine &= Sci_GetChar($hScintilla2, $iPos) ; the ASCII code of the char
    Next
    Return SetError(0, $iCurrentLine, $sTextLine)
EndFunc
Func Sci_GetCurrentLine($Sci)
    Local $SCI_GETCURRENTPOS=2008, $SCI_LINEFROMPOSITION=2166
    Local $iPos = _SendMessage($Sci, $SCI_GETCURRENTPOS, 0, 0)
    Local $iLine = _SendMessage($Sci, $SCI_LINEFROMPOSITION, $iPos, 0)
    Return SetError(@error, $iPos, $iLine)
EndFunc
Func Sci_GetLineStartPos($Sci, $Line) ;
    Local $SCI_POSITIONFROMLINE=2167
    Return _SendMessage($Sci, $SCI_POSITIONFROMLINE, $Line, 0)
EndFunc
Func Sci_GetLineEndPos($Sci, $Line)
    Local $SCI_GETLINEENDPOSITION=2136
    Return _SendMessage($Sci, $SCI_GETLINEENDPOSITION, $Line, 0)
EndFunc
Func Sci_GetChar($Sci, $Pos)
    Local $SCI_GETCHARAT=2007
    Return ChrW(_SendMessage($Sci, $SCI_GETCHARAT, $Pos, 0))
EndFunc

 

 

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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

×
×
  • Create New...