How to start PHPEd from command line to let it go to line? |
|
Hi!
I had the very same problem, and so I wrote a simple AutoIt script which can be compiled under Windows to do exactly this: edit.exe path/to/script.php#33 will open the file in PhpED and go to line 33 If run with no prameters will register the executable as he handler for the protocol, so that clicking on a link q4://path/to/script.php#33 will run the very same command at written here Here the script: #region - Compiler directives section #Compiler_OutFile="D:WebServedit.exe" #endregion $urlhandler = "D:WebServedit.exe" ;this should match Compiler_OutFile above ;config $baseprotocol="q4" $protocoldescription="URL: Q4 cms source editing protocol" ;editor to use ;$editor="C:Program FilesGeanybingeany.exe" $editor="C:Program FilesNuSpherePhpEDphped.exe" ;$editor="C:Program Files (x86)PSPad editorPSPad.exe" ;init $file="" $linenumber="" ;processing command line parameters if $CmdLine[0]>=1 then ;if we have at least one parameter ;find the source file pointed $filesplit=StringSplit($CmdLine[1],"#") $file = $filesplit[1] $file = StringReplace($file,$baseprotocol & "://","") ;$file = StringReplace($file,$baseprotocol & ":\","") $file = StringReplace($file,"/","") ;MsgBox(0, "Source file", $file) ;if the first parameter contained a #xxx use that as the line number to go to if $filesplit[0]>1 then $linenumber = $filesplit[2] EndIf ;MsgBox(0, "Line number", $linenumber) ;prepare the command line to execute $execute = '"' & $editor & '"' & " " & '"' & $file & '"' if ($linenumber<>"") then if (StringInStr($editor,"geany.exe")) then ;geany accepts :linenumber parameter to go to specific line in file $execute = $execute & ":" & $linenumber EndIf endif ;MsgBox(0, "Execute",$execute) ;run the editor Run($execute,"",@SW_MAXIMIZE) ;phped does not accept a command line to get to a specific line if ($linenumber<>"") then If (StringInStr($editor,"phped.exe")) then ;so we send Ctrl+G, line number, Enter keys to make it go to that line if WinActivate("PhpED") then Send("^g") Send($linenumber & "{ENTER}") endif endif endif Else ;if no parameter has been sent, then registers the compiled version of this script as handler for this protocol RegWrite("HKCR" & $baseprotocol, "", "REG_SZ", $protocoldescription) RegWrite("HKCR" & $baseprotocol, "URL Protocol", "REG_SZ", '') RegWrite("HKCR" & $baseprotocol & "DefaultIcon", "", "REG_SZ", '"' & $editor & '"') RegWrite("HKCR" & $baseprotocol & "shellopencommand", "", "REG_SZ", '"' & $urlhandler & '" "%1"') MsgBox(0, "RegWrite", "Registry Entries Added." & @LF) endif Hope this is useful! |
||||||||||||
|
|
Cool script, but you can also directly goto line using this parameter.
peped.exe "file.php" --line=30 As described in this post; https://forum.nusphere.com/improvement-for-opening-files-from-commandline-t4722.html |
||||||||||||
|
|
Nice info, thanks!
But someone does know where a FULL LIST of phped command line options can be found? The manual inside PhpED does not contain it, and I cannot manage to find it anywhere else... |
||||||||||||
|
How to start PHPEd from command line to let it go to line? |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by