Jump to content

Open au3 in Scite at specified line number


Recommended Posts

Hi, I am trying to open into scite an au3 file from another au3 file and then navigate to the specified line number.

I can get the test.au3 file to open in Scite but I do not know of an additional parameter to specify the line number.

ShellExecute("test.au3","","","edit")

Any ideas? Thank you.

Edited by millisys
Link to comment
Share on other sites

http://www.scintilla.org/SciTEDoc.html

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Hi BrewManNH,

Thank you for your help. I tried this but it does not seem to be working.

Run(@ComSpec & " /c " & "C:\Program Files\AutoIt3\SciTE\SciTE.exe -open:C:\\Program Files\\SciTE\\SciTEDoc.html -goto:123")
Edited by millisys
Link to comment
Share on other sites

I made a function for you, see if it work. Tested successfully on Windows XP SP3 x86

_SciteGOTO("C:\test.au3", 10)

; #FUNCTION# ====================================================================================================================
; Name ..........: _SciteGOTO
; Description ...: Open a file in SciTE at specific fileline
; Syntax ........: _SciteGOTO($s_au3[, $iLine = 1[, $s_scite = Default]])
; Parameters ....: $s_au3               - The path pf au3 file
;                  $iLine               - The line to show
;                  $s_scite             - The path where SciTE.exe is stored
; Return values .: On Success - Return True
;                  On Failure -
;                                @error = 1 The .au3 doesn't exist
;                                @error = 2 Invalid line number
;                                @error = 3 The SciTE's exe path doesn't exist
;                                @error = 4 Unable to launch SciTE
; Author ........: Nessie
; Example .......: _SciteGOTO("C:\test.au3", 10)
; ===============================================================================================================================
Func _SciteGOTO($s_au3, $iLine = 1, $s_scite = Default)

    If Not FileExists($s_au3) Then Return SetError(1, 0, "")

    If $iLine < 1 Then Return SetError(2, 0, "")

    If $s_scite = Default Then
        $s_scite = @ProgramFilesDir & "\AutoIt3\SciTE\SciTE.exe"
    EndIf

    If Not FileExists($s_scite) Then Return SetError(3, 0, "")

    $s_au3 = StringReplace($s_au3, "\", "\\")

    Run($s_scite & ' "-open:' & $s_au3 & '" -goto:' & $iLine)
    If @error Then Return SetError(4, 0, "")

    Return True
EndFunc   ;==>_SciteGOTO

Hi!

Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

No need to use ShellExecute to run an executable program, it can be done like this.

Run(@ComSpec & " /k " & "'C:\Program Files\AutoIt3\SciTE\SciTE.exe' -open:C:\\Program Files\\SciTE\\SciTEDoc.html -goto:123")

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Hi somdcomputerguy,

I tried this but it said the file couldn't be found. I checked the file structure and the file is there.

ShellExecute("C:\Program Files\AutoIt3\SciTE\SciTE.exe -open:C:\Program Files\SciTE\SciTEDoc.html -goto:123")
Link to comment
Share on other sites

Hi somdcomputerguy,

I tried this but it said the file couldn't be found. I checked the file structure and the file is there.

ShellExecute("C:\Program Files\AutoIt3\SciTE\SciTE.exe -open:C:\Program Files\SciTE\SciTEDoc.html -goto:123")

Just take a look to my message and BrewManNH too.

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

Did you copy what I posted exactly? Because there's quotes around the path to Scite.exe and that should not have happened.

Note: BTW, there's no point in using @ComSpec for this either, but I used it so that if there were an error, you'd be able to see it. @ComSpec should only be used if you're using some internal Windows command, not an external executable.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Hi BrewManNH,

I tried it again on an XP box and same results. It must be the way the computer was configured. I have had problems using @ComSpec on these computers in the past. I am sure that it would work on a normal computer.

Thank you for your help :)

Link to comment
Share on other sites

Hi Nessie,

Your function is awesome! For some reason it does not work on my installation of 2K but it works brilliantly on XP. Thank you so much!

I noticed that when I type Scite from the Run command on XP it opens up Scite. When I do the same on 2K it says it cannot find Scite. Any idea how to fix this? I apologize if this is more of a Windows than AutoIt question.

Link to comment
Share on other sites

Hi Nessie,

Your function is awesome! For some reason it does not work on my installation of 2K but it works brilliantly on XP. Thank you so much!

I noticed that when I type Scite from the Run command on XP it opens up Scite. When I do the same on 2K it says it cannot find Scite. Any idea how to fix this? I apologize if this is more of a Windows than AutoIt question.

Go to my previous post, i have changed a little bit my function and tell me what happened now ;)

Also be sure that tha SciTE path is right and is equal to:

@ProgramFilesDir & "\AutoIt3\SciTE\SciTE.exe"

If not, you have to set manually the Scite Path like:

_SciteGOTO("C:\test.au3", 10, "C:\MY_SCITE_PATH\SciTE.exe")

HI!

Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

Hi Nessie,

Awesome! That is a fantastic function.

I experimented with your first version and moved the $s_scite variable from the working directory parameter to the filename parameter and both versions now work in 2k.

Is there functionally a reason to use:

Run($s_scite & ' "-open:' & $s_au3 & '" -goto:' & $iLine)

vs:?

ShellExecute($s_scite, '"-open:' & $s_au3 & '" -goto:' & $iLine)
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...