aik099/PhpStormProtocol

can't find run_editor.js

Closed this issue · 2 comments

aik099 commented

Looking at the screenshot I can tell, that you've copied over contents from https://github.com/aik099/PhpStormProtocol/tree/master/PhpStorm%20Protocol%20(Win) folder directly to the C:\Program Files\ folder. That is incorrect.

You should copy https://github.com/aik099/PhpStormProtocol/tree/master/PhpStorm%20Protocol%20(Win) folder itself into C:\Program Files\ so at the end you'll have a C:\Program Files\PhpStorm Protocol (Win) folder and any further actions should happen in there.

Yes, the reason for pop occus is the wrong path of run_editor.js. But for phpstorm://open?file=%file&line=%line format , Your regexp is not suitable.
So i rewrite the script for myself.

var settings = {
    bin_path: "D:\\Program Files\\JetBrains\\PhpStorm 2022.3.2\\bin\\phpstorm64.exe ",
    window_title: 'PhpStorm'
};
var url = decodeURIComponent(WScript.Arguments(0));
//WScript.Echo(url);
if(url.indexOf('phpstorm') != -1){
	var line = url.substring(url.indexOf('&line=')+6);
	url = url.substring(url.indexOf('file='));
	var file = url.substring(url.indexOf('file=')+5, url.indexOf('&'));
	var editor = settings.bin_path+'--line %line% "%file%"';
	var command = editor.replace(/%line%/g, line)
        .replace(/%file%/g, file)
        .replace(/\//g, '\\');
    //WScript.Echo(command);
    var shell = new ActiveXObject('WScript.Shell');
    shell.Exec(command);
    shell.AppActivate(settings.window_title);
}else{
	WScript.Echo(url.indexOf('错误的url协议'));
}

Which is less complex and works ok.