クリップボードマネージャCopyQの日本語の情報を補完するものです。

×

コメントなどの日本語はEncodingが合ってないので文字化けしてる

行頭に文字( >)を挿入

[Command]
Name=Insert string to line head
Command="
    copyq:
    // 行頭に> を挿入する
    // \x884c\x982d\x306b> \x3092\x633f\x5165\x3059\x308b
    
    var text = str(clipboard())
    var instxt = dialog('\x884c\x982d\x4ed8\x52a0\x6587\x5b57\xff1a','>\\x20')
    var newText = text.replace(/^/gm,instxt)
    copy(newText)
    paste()"
IsGlobalShortcut=true
Icon=\xf034
GlobalShortcut=ctrl+alt+q

日付形式変換1

日付 1999年12月05日を1999-12-05 に変換する
[Command]
Name=Replace Date Format1
Command="
    copyq:
    // \x65e5\x4ed8 1999\x5e74\x31\x32\x6708\x30\x35\x65e5\x3092\x31\x39\x39\x39-12-05 \x306b\x5909\x63db\x3059\x308b
    var text = str(clipboard())
    var rpc = new RegExp(\"([0-9]{4})\x5e74([0-9]{1,2})\x6708([0-9]{1,2})\x65e5\",'gm')
    var newText = text.replace(rpc,'$1-$2-$3')
    copy(newText)
    paste()"
IsGlobalShortcut=true
Icon=\xf15b
GlobalShortcut=ctrl+shift+e

日付形式変換2

日付 1999-12-05を 1999年12月05日に変換する
[Command]
Name=Replace Date Format2
Command="
    copyq:
    // \x65e5\x4ed8 1999-12-05 \x3092\x31\x39\x39\x39\x5e74\x31\x32\x6708\x30\x35\x65e5\x306b\x5909\x63db\x3059\x308b
    var text = str(clipboard())
    var rpc = new RegExp(\"([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})\",'gm')
    var newText = text.replace(rpc,'$1\x5e74$2\x6708$3\x65e5')
    copy(newText)
    paste()"
IsGlobalShortcut=true
Icon=\xf15b
GlobalShortcut=ctrl+alt+t

「ひらがな」を「カタカナ」に変換

[Command]
Name=Hiragana2katakana
Command="
    copyq:
    // convert Hiragana to Katakana
    function hiraganaToKatakana(src) {
        return src.replace(/[\\u3041-\\u3096]/g, function(match) {
            var ch = match.charCodeAt(0) + 0x60;
            return String.fromCharCode(ch);
        });
    }
    
    var newText = hiraganaToKatakana(str(clipboard()))
    copy(newText)
    paste()
    
    "
IsGlobalShortcut=true
Icon=\xf15b
GlobalShortcut=ctrl+shift+w

「カタカナ」を「ひらがな」に変換

[Command]
Name=Katakana2hiragana
Command="
    copyq:
    // convert Katakana to Hiragana
    function katakanaToHiragana(src) {
        return src.replace(/[\\u30A1-\\u30FA]/g, function(match) {
            var ch = match.charCodeAt(0) - 0x60;
            return String.fromCharCode(ch);
        });
    }
    
    var newText = katakanaToHiragana(str(clipboard()))
    copy(newText)
    paste()
    "
IsGlobalShortcut=true
Icon=\xf15b
GlobalShortcut=ctrl+shift+s

文字数カウント

クリップボード内のテキストの文字数(スペースも含む)をポップアップ
[Command]
Name=Count
Command="
    copyq:
    var seconds = 3;
    var count =str(clipboard()).length
    popup(\"\x6587\x5b57\x6570\xff1a\", count, seconds*1000)"
InMenu=true
Icon=\xf15b

数値の総和

コピーした数値を足し算してポップアップ表示
[Command]
Name=Sum of Copied value
Command="
    copyq:
    if (!copy())
      abort()
    var sum = 0;
    var text = str(clipboard())
    var textArray = text.split(/\\r\\n|\\r|\\n/)
    for (var i = textArray.length - 1; i >= 0 ; i--){
            var result = Number( textArray[i].replace(/,/g, '') ); 
            sum = sum + result;
    }
    popup('Sum of copied value', sum, 7000)"
InMenu=true
IsGlobalShortcut=true
Icon=\xf24d
GlobalShortcut=ctrl+1

SEND KEY

マルチカラムなどでタブをSENDしたい場合
(,をTABキーに置き換える)
[Command]
Name=SEND KEY
Command="
powershell:
$env:COPYQ = "C:\Program Files (x86)\CopyQ\copyQ"
Add-Type -Assembly System.Windows.Forms
$Item1 = (& "$env:COPYQ" read 0 | Out-String)
$array = $Item1.split(",")
foreach ($a in $array){
  (& "$env:COPYQ" copy($a)) #$strをクリップボードへ
  (& "$env:COPYQ" paste)
  Start-Sleep -s 1
  [System.Windows.Forms.SendKeys]::SendWait("{TAB}") #TABキー/ENTERキー
}"

メンバーのみ編集できます