RE: Code Genie goto error line

new topic     » topic index » view thread      » older message » newer message

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C23823.5EE87A60
 charset=iso-8859-1

Brian,
I had a bit of trouble with this routine. Here is my fix for it.

Sub JumpToError
   Dim fso, file, line, errline, p
   Const ForReading = 1
  
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set file = fso.OpenTextFile(Doc.FileDir&"ex.err",ForReading)
  
   line = file.ReadLine           

   ' --- Fix Starts
   ' -- This fix strips of stuff after the line number --
   ' -- errline = Right(line,len(line)-InStrRev(line,":"))
   p = InStrRev(line, ":")
   errline = mid(line, p+1)
   p = InStr(errline, " ")
   if p <> 0 then
      errline = left(errline, p-1)
   end if
   ' --- Fix Ends

   line = line & vbCr & file.ReadLine
   ' show first two lines of ex.err in a MsgBox
   Doc.MsgBox line
   ' set cursor to error line
   Doc.SSE = Doc.LineToPos(CInt(errline)-1)
   file.Close
End Sub


> -----Original Message-----
> From: Brian Broker [mailto:bkb at cnw.com]
> Sent: Wednesday, 31 July 2002 7:16
> To: EUforum
> Subject: Code Genie goto error line
> 
> 
> 
> This is not very smart in that you must have the file containing the 
> error open and with focus.  Also, if the error is in an include file 
> that's not in the same directory as your program (and ex.err) then it 
> won't help you.  It might be better to use a RegExp object to parse 
> ex.err but I'm not very good with regular expressions and 
> this seems to 
> do the job anyway.  I have a Euphoria.vbs file in my Macros 
> folder with 
> the following routine:
> 
> Sub JumpToError
>    Dim fso, file, line, errline
>    Const ForReading = 1
>   
>    Set fso = CreateObject("Scripting.FileSystemObject")
>    Set file = fso.OpenTextFile(Doc.FileDir&"ex.err",ForReading)
>   
>    line = file.ReadLine
>    errline = Right(line,len(line)-InStrRev(line,":"))
>    line = line & vbCr & file.ReadLine
>    ' show first two lines of ex.err in a MsgBox
>    Doc.MsgBox line
>    ' set cursor to error line
>    Doc.SSE = Doc.LineToPos(CInt(errline)-1)
>    file.Close
> End Sub
> 
> Then you can add the following shortcut at the end of cgenie.conf:
> 
> Shortcut  Euphoria.vbs JumpToError F8
> 
> It's just a start and if I can figure out how to make it smarter then 
> I'll post it to the list.  Or if anybody else is good with scripting 
> then post your solution for us.
> 
> -- Brian
> 
> 10963508 wrote:
> > This is the editor I have been looking for.
> > Did any euphoria programmer write these macros, to save me 
> some time:
> > 
> > F5: execute program
> > F8: go to error line
> 
> 
> 
> 

==================================================================
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en 
is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht 
onterecht ontvangt wordt u verzocht de inhoud niet te gebruiken en 
de afzender direct te informeren door het bericht te retourneren. 
==================================================================
The information contained in this message may be confidential 
and is intended to be exclusively for the addressee. Should you 
receive this message unintentionally, please do not use the contents 
herein and notify the sender immediately by return e-mail.


==================================================================

------_=_NextPart_000_01C23823.5EE87A60
Content-Type: application/ms-tnef

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu