2019年10月25日金曜日

7zca.dllを使う


解凍ソフトでは7-Zipが個人的に好きでずっと使ってる。
以前はscriptを作って7zG.exeを実行したりしてたが(7-zip(7zG.exe)で書庫の展開)、今なら7zca.dllを使えばよさげ。


1.TORO's Libraryから7zca.dllをダウンロードし、PPXフォルダに入れる
2.7-Zipフォルダ内にある7zip.dllのパスを通す。とりあえずPPXフォルダにコピーすればよさそう
3.以下を編集して取込

P_arc = {
7zca64.DLL = B10000000010,0,Szipca
 a=x "%1" "%!2%\" *
 e=e "%1" "%!2%\" %@
 s=e "%1" "%2" "%C"
7zca32.DLL = B10000000001,0,Szipca
 a=x "%1" "%!2%\" *
 e=e "%1" "%!2%\" %@
 s=e "%1" "%2" "%C"
}


4.カスタマイザーの「その他 - 書庫DLL/P_arc」で7zca64.DLLを上の方へ

2019年10月16日水曜日

一行編集からAIMP4を操作


補完候補リストによく使うコマンドラインを追加して、一行編集からAIMP4を操作できるようにする。

D:\bin\AIMP4\AIMP.exe /PLAY
D:\bin\AIMP4\AIMP.exe /PLAYPAUSE
D:\bin\AIMP4\AIMP.exe /NEXT
D:\bin\AIMP4\AIMP.exe /PPREV
D:\bin\AIMP4\AIMP.exe /EXIT
D:\bin\AIMP4\AIMP.exe /RESTORE

それほど頻繁に使わないけど、コマンドラインオプションは記憶させたいときは

D:\bin\AIMP4\AIMP.exe
 /PLAY
 /PLAYPAUSE
 /NEXT
 /PPREV
 /EXIT
 /RESTORE

とする。こうすると、AIMP4のパス入力後にSpaceキーを押すと、コマンドが補完される。


参考:AIMP4のコマンドラインオプション


/ADD_PLAY - Add objects to a playlist and start playing.
/BOOKMARK - Add files and / or folders to your bookmarks.
/DIR - Add folder(s) to the playlist.
/FILE - Add file(s) to the playlist.
/INSERT - Add objects to the active playlist.
/QUEUE - Add objects to the active playlist and put them in custom playback queue.
/RESTORE - Bring player to top.
/SKIN - Install skins to AIMP. After installation, opens the Preferences window on the choice of skin.
/PLS - Opens playlists in new tabs.
/CDA - Creates a new playlist with a list of files from a specified media and starts its playback.
/PLAY - Start playing.
/PLAYPAUSE - Start playing / Pause playback.
/PAUSE - Pause playback.
/STOP - Stop playback.
/NEXT - Next file.
/PREV - Previous file.
/MUTE - Mute / Unmute .
/VOLUP - Increase volume.
/VOLDWN - Reduce Volume.
/EXIT - Exit from the app.

2019年10月13日日曜日

現在窓の位置を複数記憶(UserDataバージョン)


現在窓の位置を複数記憶し、再現できるようにする。
以前の記事では同じことをエイリアスを使用して行ったが、今回はユーザーデータを使用する。

Script


以前のSetDimensions.jsとほぼ同じだが、区切り文字を「,」から「;」に変更している。

SetDimensions2.js

//!*script 
// 窓の位置と大きさを変更する
// 第一引数:"x;y;width;height"
// PPXMES.DLLとPPXWIN.DLLが必要

// 引数がなければ終了
if (PPx.Arguments.Length < 1){
  PPx.SetPopLineMessage("引数が正しくありません。");
  PPx.Quit(-1);
}

var hoge = PPx.Arguments.Item(0).split( ";" );

// 実行元が一体型PPcかそれ以外かで分岐
if (PPx.GetComboItemCount != 0&&PPx.Extract('%n').substr(0,1)=="C"){
  PPx.Execute("*windowposition %*findwindowclass\(\"PaperPlaneCombo\"\)"+","+hoge[0]+","+hoge[1]); // 位置の変更
  PPx.Execute("*windowsize %*findwindowclass\(\"PaperPlaneCombo\"\)"+","+hoge[2]+","+hoge[3]); // 大きさの変更
} else {
  PPx.Execute("*windowposition %N"+","+hoge[0]+","+hoge[1]); // 位置の変更
  PPx.Execute("*windowsize %N"+","+hoge[2]+","+hoge[3]); // 大きさの変更
}


窓の位置を登録


*script %0\Script\setSeqUserData.js,ppvpos,%*windowrect(,l);%*windowrect(,t);%*windowrect(,w);%*windowrect(,h)

これを実行するたび、ppvpos0 ppvpos1 ppopos2…に現在窓の位置と大きさ(x;y;width;height)を登録する。

窓の位置を変更


*script %0\Script\SetDimensions2.js,%*script(%0\Script\getSeqUserData.js,ppvpos)

getSeqUserData.jsを実行するたび、順次ppvpos0 ppvpos1 ppopos2…の中身を返すので、その値を使いSetDimentions2.jsで窓の位置と大きさを変更する。

登録例


僕はPPVに2ストロークキーで登録。


  • C_s,s 登録
  • C_s,C_s 実行
  • C_s,e エディタで編集

-|K_SetPPvDimensions =

KV_main = { ; PPvメイン窓
^S ,*setnextkey K_SetPPvDimensions
}

K_SetPPvDimensions = { ** comment **
S , *script %0\Script\setSeqUserData.js,ppvpos,%*windowrect(,l);%*windowrect(,t);%*windowrect(,w);%*windowrect(,h)
^S ,*script %0\Script\SetDimensions2.js,%*script(%0\Script\getSeqUserData.js,ppvpos)
E , *ppb -c *string o,name=%%*script(%%0\Script\SeqUserData2file.js,ppvpos) %%: %%Obsq xyzzy %%so"name" %%: *script %%0\Script\file2SeqUserData.js,ppvpos,%%so"name"
}


2019年10月12日土曜日

PPc - xyzzy間フォーカス切り替え

Shift+Tabで、PPcとXyzzyのフォーカス切り替えをする。

PPx

KC_main = { ; PPcメイン窓
\TAB ,*focus "-xyzzy-"
}


xyzzy

; xyzzyのタイトルバーの書式に -xyzzy-を含ませる。
(setq-default title-bar-format "-xyzzy- %f (%M) [%k:%l]")
; Shift+TabでPPcにフォーカス
(set-extended-key-translate-table exkey-S-tab #\F20)
(global-set-key '#\F20 #'(lambda () (interactive)
      (call-process "D:\\bin\\ppx\\PPTRAYW.EXE -c *focus C")))

2019年10月10日木曜日

設定ファイルの一部を取得

・設定ファイルから任意の設定項目を取り出し、クリップボードにコピーする
・文字コードがUTF-16のPPX.CFGがPPXフォルダにあることが前提


準備


1.BusyBoxからバイナリをダウンロードし、busybox64.exeをPPXフォルダに入れる
2.以下を編集して取込

_Command = { ; ユーザコマンド・関数
cfg2sed2clip = %Obsq %0busybox64.exe iconv -f UTF16 -t UTF8 %0PPX.cfg | %0busybox64.exe sed -n "/^%*arg(1)/{p; :loop n; p; /^}/q b loop }"  | %0busybox64.exe iconv -f UTF-8 -t CP932 | clip
}

KC_main = { ; PPcメイン窓
'@' ,*string o,name=%*regexp("%*input("" -title:"CFG部分取得" -mode:e -k:"*completelist /set /file:%%0PPX.CFG")","s/^(.*);/$1/") %:
  *ifmatch "/{/","%so"name"" %: *cfg2sed2clip "%so"name"" %: *stop
  *cliptext %so"name"
}

使い方


・@を押すと、PPX.CFGを補完候補リストにした一行編集が表示される
・X_vzs = 0のような一行形式のものは、その行をクリップボードにコピー
・KC_mainのような複数行に渡るものは、{}の中身を含めてクリップボードにコピー

ユーザーコマンドとして使う場合


_Command = { ; ユーザコマンド・関数
cfg2sed2clip = %Obsq %0busybox64.exe iconv -f UTF16 -t UTF8 %0PPX.cfg | %0busybox64.exe sed -n "/^%*arg(1)/{p; :loop n; p; /^}/q b loop }"  | %0busybox64.exe iconv -f UTF-8 -t CP932 | clip
cfgfazzy = *string o,name=%*regexp("%*input("" -title:"CFG部分取得" -mode:e -k:"*completelist /set /file:%%0PPX.CFG")","s/^(.*);/$1/") %:
 *ifmatch "/{/","%so"name"" %: *cfg2sed2clip "%so"name"" %: *stop
 *cliptext %so"name"
}

参考






2019年10月7日月曜日

一行編集で定型文取得



一行編集の候補ファイルに、次のように記載しておけば定型文をクリップボードにコピーできる。

*cliptext (」・ω・)」つかー! (/・ω・)/にゃーん!
*cliptext <pre class="prettyprint">%bn</pre> %mブログ用タグ
*cliptext %*now %m現在日時
*cliptext %*now(date) %m今日の日付

%mでメモを記載して検索をしやすくしたり、%bt、%bnでタブ文字や改行文字を入れたりすることも可能。また、

X_ltab = 4

とすると、一行編集でもmigemoを有効にできるようだ。

2019年10月6日日曜日

一行編集でランチャ改

PPxをランチャとして使う」の連載記事以降、色々と動きがあったので書き直す。新しく追加された%*inputを利用。某大型掲示板を参考に、スクリプトを使ってた箇所を使わずに済ませたり、無駄に煩雑な箇所をシンプルにしたりした。

1.PPtrayを使いホットキー(Ctrl+Space)で起動。トグル動作をする
2.l_cmd.txtを登録。コマンド、実行パス、フォルダを混在して記載
3.実行パス→実行、フォルダ→PPCで開く、その他→コマンド実行と分岐

_Command = { ; ユーザコマンド・関数
ppl = *string o,name=%*input("" -title:"PPlauncher" -mode:e -k:"*completelist /set /file:%%0l_cmd.txt") %:
 *ifmatch "o:e,a:d+",%so"name" %: *execute C,*jumppath "%so"name"" %: *stop
 *ifmatch "o:e,a:d-",%so"name" %: *execute ,"%so"name"" %: *stop
 *execute,%so"name"
}

K_tray = { ; PPtrayホットキー(キー指定 不可,V_xx 形式を推奨)
^' ' ,*focus !#%*findwindowtitle("PPlauncher"),%0\PPTRAYW.EXE -c *ppl
}

l_cmd.txt
howm2dir
xyzzy
D:\bin
D:\Data
D:\Download
D:\work
D:\Temp
D:\bin\afxw\AFXW.EXE
D:\bin\AIMP4\AIMP.exe
D:\bin\NeeView\NeeView.exe
D:\bin\nyanfi\NyanFi.exe
*ppb
*ppc ;PPcを実行
*ppc -runas ;管理者/別のユーザでPPcを実行
*ppv
*pptray
*ppcust
*closeppx ;[wildcard] 全PPx終了
*screensaver ;スクリーンセーバを起動
*monitoroff ;モニターを省電力モードにする
*logoff ;Windows をログオフ
*poweroff ;Windows をシャットダウンし、電源を切る
*reboot ;Windows を再起動
*shutdown ;Windows をシャットダウン
*terminate ;Windows を強制シャットダウン
*suspend ;サスペンド状態に移行
*hibernate ;休止状態に移行
*ppe  ;"filename"  PPeで編集(終了待ちしない)