同步现在的代码
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora]
|
||||
@="URL:Typora Protocol"
|
||||
"URL Protocol"=""
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora\shell]
|
||||
@="open"
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora\shell\open]
|
||||
@="Open Typora"
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora\shell\open\command]
|
||||
@="wscript.exe \"D:\\projects\\my-website\\tools\\typora-handler.wsf\" \"%1\""
|
||||
@@ -0,0 +1,13 @@
|
||||
<package>
|
||||
<job id="openTypora">
|
||||
<script language="JScript">
|
||||
var url = WScript.Arguments(0);
|
||||
var filePath = decodeURIComponent(url)
|
||||
.replace(/^typora:\/\/file\//, '')
|
||||
.replace(/\//g, '\\');
|
||||
new ActiveXObject("WScript.Shell").Run(
|
||||
'"D:\\Program Files\\Typora\\Typora.exe" "' + filePath + '"', 0, false
|
||||
);
|
||||
</script>
|
||||
</job>
|
||||
</package>
|
||||
@@ -0,0 +1,14 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora]
|
||||
@="URL:Typora Protocol"
|
||||
"URL Protocol"=""
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora\shell]
|
||||
@="open"
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora\shell\open]
|
||||
@="Open Typora"
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora\shell\open\command]
|
||||
@="\"C:\\nvm4w\\nodejs\\node.exe\" \"D:\\projects\\my-website\\tools\\typora-handler.js\" \"%1\""
|
||||
@@ -0,0 +1,14 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora]
|
||||
@="URL:Typora Protocol"
|
||||
"URL Protocol"=""
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora\shell]
|
||||
@="open"
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora\shell\open]
|
||||
@="Open Typora"
|
||||
|
||||
[HKEY_CLASSES_ROOT\typora\shell\open\command]
|
||||
@="wscript.exe \"D:\\projects\\my-website\\tools\\typora-handler.vbs\" \"%1\""
|
||||
@@ -0,0 +1,14 @@
|
||||
const { exec } = require('child_process');
|
||||
const fs = require('fs');
|
||||
const url = process.argv[2];
|
||||
const filePath = decodeURIComponent(url)
|
||||
.replace(/^typora:\/\/file\//, '')
|
||||
.replace(/\//g, '\\');
|
||||
|
||||
//fs.writeFileSync(__dirname + '/typora-debug.log',`url: ${url}\nfilePath: ${filePath}\n`, 'utf8');
|
||||
|
||||
exec('"D:\\Program Files\\Typora\\Typora.exe" "' + filePath + '"', (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
//fs.appendFileSync(__dirname + '/typora-debug.log', 'err: ' + err.message + '\n');
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
' typora-handler.vbs
|
||||
' 获取传入的参数,也就是 typora:// 后面的完整链接
|
||||
Dim url
|
||||
url = WScript.Arguments(0)
|
||||
|
||||
' 创建一个 Shell 对象
|
||||
Set WshShell = CreateObject("WScript.Shell")
|
||||
|
||||
' 构造要执行的命令
|
||||
' 注意:这里的路径需要根据你电脑上 node.exe 和 .js 文件的实际位置来写
|
||||
Dim command
|
||||
command = """C:\nvm4w\nodejs\node.exe"" ""D:\projects\my-website\tools\typora-handler.js"" """ & url & """"
|
||||
|
||||
' 执行命令
|
||||
' 参数 0 表示隐藏窗口,False 表示不等待程序结束就返回
|
||||
WshShell.Run command, 0, False
|
||||
|
||||
Set WshShell = Nothing
|
||||
Reference in New Issue
Block a user