Notepad2(mod) 相關設定

@echo off
title Notepad2-mod (新增/刪除右鍵選單)
echo.
SET /P ST=輸入y新增右鍵選單,輸入n刪除右鍵選單:
if /I "%ST%"=="y" goto Add
if /I "%ST%"=="n" goto Remove
:Add
reg add "HKEY_CLASSES_ROOT\*\shell\NotePad2" /ve /t REG_SZ /d "用 &NotePad2 打開" /f
reg add "HKEY_CLASSES_ROOT\*\shell\NotePad2\command" /ve /t REG_SZ /d "\"%~dp0Notepad2.exe\" ""%%1""" /f
exit
:Remove
reg delete "HKEY_CLASSES_ROOT\*\shell\NotePad2" /f
exit
view raw ContextMenu.bat hosted with ❤ by GitHub
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Notepad2]
[HKEY_CLASSES_ROOT\*\shell\Notepad2\command]
@="notepad.exe %1"
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\*\shell\Notepad2]
@echo off
title Notepad2-mod (替換/恢復系統記事本)
echo.
SET /P ST=輸入y替換系統記事本,輸入n恢復系統記事本:
if /I "%ST%"=="y" goto Replace
if /I "%ST%"=="n" goto Restoration
:Replace
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"%~dp0Notepad2.exe\" /z" /f
exit
:Restoration
reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /f
exit

Add "Open with Notepad" to the Context Menu for All Files 替換∕恢復系統記事本.bat & 添加∕刪除右鍵菜單.bat

replace space in filename/folder

@ECHO OFF
SETLOCAL EnableDelayedExpansion
FOR /R %%i IN (*.zip) DO (
SET NewName=%%~nxi
SET NewName=!NewName: =_!
REN "%%i" "!NewName!"
ECHO !NewName!
)
PAUSE
@ECHO OFF
SETLOCAL EnableDelayedExpansion
FOR /D %%i IN ("E:\test22\*") DO (
SET NewName=%%~nxi
SET NewName=!NewName:AVI=!
REN "%%i" "!NewName!"
ECHO !NewName!
)
PAUSE

Pushbullet API (nodejs/vb.net/jQuery)

$.ajax({
url: 'https://api.pushbullet.com/v2/pushes',
type: 'post',
data: {
type: 'note',
title: '安桌椅測試 from jQuery',
body: 'あいうえお'
},
headers: {
Authorization: 'Bearer <your_access_token_here>'
},
dataType: 'json',
success: function(data) {
console.dir(data);
}
});
view raw jq.js hosted with ❤ by GitHub
var request = require('request'),
token = '<your_access_token_here>';
request({
method: 'POST',
uri: 'https://api.pushbullet.com/v2/pushes',
headers: {
Authorization: 'Bearer' + token
},
form: {
type: 'note',
title: '安桌椅測試 from nodejs',
body: 'あいうえお'
}
}, function(error, response, body) {
if (error) {
console.log(response.statusCode);
throw error;
} else {
console.log(body);
}
});
// list Devices
request({
method: 'GET',
uri: 'https://api.pushbullet.com/v2/devices',
headers: {
Authorization: 'Bearer ' + token
},
}, function(error, response, body) {
if (error) {
console.log(response.statusCode);
throw error;
} else {
var j = JSON.parse(body),
devices = j.devices;
for (var i = 0; i < devices.length; i++) {
console.log('%s => %s', devices[i].nickname, devices[i].iden);
}
}
});
//push to a specific device
request({
method: 'POST',
uri: 'https://api.pushbullet.com/v2/pushes',
headers: {
Authorization: 'Bearer ' + token
},
form: {
device_iden: 'xxxxxxxxxxxxxxxxxxxx',
type: 'link',
title: myTitle,
url: myURL
}
}, function(error, response, body) {
if (error) {
throw error;
} else {
//console.log(body);
}
});
view raw nodejs.js hosted with ❤ by GitHub
$token = "<your_access_token_here>"
$postParams = @{ iden = $iden;
type = "note";
title = "This is TITLE";
body = "This is BODY";
}
$req = Invoke-WebRequest -Uri "https://api.pushbullet.com/v2/pushes" `
-Method Post `
-Headers @{"Authorization" = "Bearer $($token)"} `
-Body $postParams
Write-Host "[Pushbullet Send] $($req.StatusDescription) ($($req.StatusCode))"
$token = "<your_access_token_here>"
$iden = "<your_device_id_here>"
$pass = ConvertTo-SecureString "none" -AsPlainText -Force
$auth = New-Object System.Management.Automation.PSCredential ($token, $pass)
$url = "https://api.pushbullet.com/v2/pushes";
$data = @{ iden = $iden
type = "note"
title = "This is TITLE";
body = "This is BODY";
}
Invoke-RestMethod -Method POST -Uri $url -Credential $auth -UseBasicParsing -ErrorAction SilentlyContinue -Body $data | Out-Null
Write-Host "[Pushbullet Send] Done"
Using wc As New WebClient
Try
Dim para As New NameValueCollection
para.Add("email", "yourmail@gmail.com")
para.Add("type", "note")
para.Add("title", "This Is Title")
para.Add("body", "Content Put Here")
wc.Encoding = Encoding.UTF8
wc.Headers.Add("Authorization", "Bearer <your_access_token_here>")
Dim bResult() As Byte = wc.UploadValues("https://api.pushbullet.com/v2/pushes", para)
context.Response.Write(Encoding.UTF8.GetString(bResult))
Catch ex As Exception
HttpContext.Current.Response.Write(ex.InnerException)
End Try
End Using
view raw send.vb hosted with ❤ by GitHub

AutoHotKey MsgBox with parameter

使用參數方式,傳入title及內容,可當node.js或batch程式的訊息顯示
MsgBox ,262144,%1%,%2%
view raw MsgBox.ahk hosted with ❤ by GitHub
/*Loop, %0% ; For each parameter:
{
param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
MsgBox, 4,, Parameter number %A_Index% is %param%. Continue?
IfMsgBox, No
break
}
*/
IF 0 = 2
{
MsgBox ,262144,%1%,%2%,10
}
ELSE IF 0 = 3
{
MsgBox ,262148,%1%,%2%,10
IfMsgBox, Yes
{
RUN %3%
}
}
view raw MsgBox2.ahk hosted with ❤ by GitHub
呼叫方式:
C:\Program Files\AutoHotKey\AutoHotkey.exe D:\MsgBox.ahk "This Is Title" "This Is Message"
C:\Program Files\AutoHotKey\AutoHotkey.exe D:\MsgBox2.ahk "Storm" "發現新主題,是否開啟?" "http://www.google.com.tw"


MsgBox