Jump to content
Sign in to follow this  
Inververs

command line in SciTe to autostart script?

Recommended Posts

Inververs

whether there SciTe command startup script at the opening?

something like this: SciTE.exe script.au3 -start?

Edited by Inververs

Share this post


Link to post
Share on other sites
Jos

There is no direct SciTE option as far as I know, but you could use a script to do this for you.

Compile this script and then open the scriptfile with this EXE. it will open the file in SciTE and do the GO command. SciTE needs to run with this script.

;  Check if parameter is specified
If $CmdLine[0] = 1 then  
    ConsoleWrite('+ Opening and runnning file:' & $CmdLine[1] & @CRLF)
    SendSciTE_Command("open:" & StringReplace($CmdLine[1],"\","\\"))  ; Open the file from the commandline
    SendSciTE_Command("menucommand:303")  ; Go command
;~  SendSciTE_Command("close:")           ; close file
Else
    ConsoleWrite('! Specify file to run!' & @CRLF)
EndIf
;
; Send command to SciTE
Func SendSciTE_Command($sCmd)
    ; Get SciTE DirectorHandle
    Local $WM_COPYDATA = 74
    Local $Scite_hwnd = WinGetHandle("DirectorExtension")
    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',0 ,'Ptr', DllStructGetPtr($COPYDATA))
EndFunc   ;==>SendSciTE_Command

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Jos

There is no direct SciTE option as far as I know, but you could use a script to do this for you.

I take this back... this also works:

"C:Program Files (x86)AutoIt3SciTESciTE.exe" "-open:C:pathtest.au3" "-menucommand:303"

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Inververs

Jos, thanks! Menucommand is what you need.

Before that, I used the following code:

Run($scite_path & ' ' & $CmdLine[2])
WinActivate(WinWait("[CLASS:SciTEWindow]"))
Send('{F5}')
Now I will restart the script your way.

:thumbsup:

Edited by Inververs

Share this post


Link to post
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
Sign in to follow this  

×