Skip to content

Instantly share code, notes, and snippets.

@sakai-memoru
Last active November 15, 2019 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakai-memoru/8ef362e542701acd8e4e8d1410e185f5 to your computer and use it in GitHub Desktop.
Save sakai-memoru/8ef362e542701acd8e4e8d1410e185f5 to your computer and use it in GitHub Desktop.

Sakura Macro : open_mdeditor.jse

  • Sakura Editorで編集中のファイルを、保存して、Markdown Editor(Typora.exe)で開く。
(function(){
//
// Typora で編集ファイルを開く
function doProcess(expandParam){
var target_ = Editor.ExpandParameter(expandParam);
var cmd_statement = "typora.exe " + target_
Editor.ExecCommand(cmd_statement, 0)
}
// -------------- entry point
if(typeof(Editor) !== 'undefined'){
// $F : opened file's full path
// $f : opened file's name
// $e : opened file's folder path
// $b : opened file's extention
// $C : 選択中の場合、選択テキストの1行目のテキスト(改行コード除く)
// 選択中でない場合、カーソル位置の単語
doProcess('$F');
} else {
if(typeof(WScript) !== 'undefined'){
WScript.Echo('[Warn] This script is for sakura macro. A env is maybe wsh.')
} else {
console.log('[Warn] This script is for sakura macro. A env is maybe node.')
}
}
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment