「Ruby を実行」の版間の差分

MSY-07 (トーク | 投稿記録)
リンク用のマークアップを追加
MSY-07 (トーク | 投稿記録)
文の末尾にセミコロンを追加
17行目: 17行目:


// rubyw.exe の場所を指定
// rubyw.exe の場所を指定
var RUBY_PATH = 'C:\\Program Files\\rubyinstaller-2.7.1-1-x64\\bin\\rubyw.exe'
var RUBY_PATH = 'C:\\Program Files\\rubyinstaller-2.7.1-1-x64\\bin\\rubyw.exe';


if (document.selection.IsEmpty) {
if (document.selection.IsEmpty) {
   document.selection.EndOfLine(false, mePosLogical)
   document.selection.EndOfLine(false, mePosLogical);
   document.selection.StartOfLine(true, mePosLogical)
   document.selection.StartOfLine(true, mePosLogical);
}
}


var shell = new ActiveXObject('WScript.Shell')
var shell = new ActiveXObject('WScript.Shell');
shell.CurrentDirectory = document.Path || shell.SpecialFolders("Desktop")
shell.CurrentDirectory = document.Path || shell.SpecialFolders("Desktop");


var exec = shell.Exec(
var exec = shell.Exec(
47行目: 47行目:
       'print e(%_#<#{e.full_message}>_);' +
       'print e(%_#<#{e.full_message}>_);' +
     'end' +
     'end' +
   '"')
   '"');


exec.StdIn.WriteLine(encodeURIComponent(document.FullName))
exec.StdIn.WriteLine(encodeURIComponent(document.FullName));
exec.StdIn.Write(encodeURIComponent(document.selection.text))
exec.StdIn.Write(encodeURIComponent(document.selection.text));
exec.StdIn.Close()
exec.StdIn.Close();
document.selection.text = decodeURIComponent(exec.StdOut.ReadAll())
document.selection.text = decodeURIComponent(exec.StdOut.ReadAll());
</syntaxhighlight>
</syntaxhighlight>


58行目: 58行目:
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// Rubyを実行 (アウトプットバー版).js
// Rubyを実行 (アウトプットバー版).js
'use strict'
'use strict';


// rubyw.exe の場所を指定
// rubyw.exe の場所を指定
var RUBY_PATH = 'C:\\Program Files\\rubyinstaller-2.7.1-1-x64\\bin\\rubyw.exe'
var RUBY_PATH = 'C:\\Program Files\\rubyinstaller-2.7.1-1-x64\\bin\\rubyw.exe';


if (document.selection.IsEmpty) {
if (document.selection.IsEmpty) {
   document.selection.EndOfLine(false, mePosLogical)
   document.selection.EndOfLine(false, mePosLogical);
   document.selection.StartOfLine(true, mePosLogical)
   document.selection.StartOfLine(true, mePosLogical);
}
}


var shell = new ActiveXObject('WScript.Shell')
var shell = new ActiveXObject('WScript.Shell');
shell.CurrentDirectory = document.Path || shell.SpecialFolders("Desktop")
shell.CurrentDirectory = document.Path || shell.SpecialFolders("Desktop");


var exec = shell.Exec(
var exec = shell.Exec(
91行目: 91行目:
       'print e(%_#<#{e.full_message}>_);' +
       'print e(%_#<#{e.full_message}>_);' +
     'end' +
     'end' +
   '"')
   '"');


exec.StdIn.WriteLine(encodeURIComponent(document.FullName))
exec.StdIn.WriteLine(encodeURIComponent(document.FullName));
exec.StdIn.Write(encodeURIComponent(document.selection.text))
exec.StdIn.Write(encodeURIComponent(document.selection.text));
exec.StdIn.Close()
exec.StdIn.Close();


outputbar.visible = true
outputbar.visible = true;
outputbar.Writeln(decodeURIComponent(exec.StdOut.ReadAll()))
outputbar.Writeln(decodeURIComponent(exec.StdOut.ReadAll()));
</syntaxhighlight>
</syntaxhighlight>
スポンサーリンク