Skip to content

Instantly share code, notes, and snippets.

@10sr
Created February 23, 2010 05:39
Show Gist options
  • Save 10sr/311905 to your computer and use it in GitHub Desktop.
Save 10sr/311905 to your computer and use it in GitHub Desktop.
xmplayコントローラ
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;前準備
#NoTrayIcon
CoordMode,menu,screen
SplitPath, A_LineFile, xmpc_scriptname, xmpc_scriptdir,
DetectHiddenWindows, on ;隠しウィンドウを見つける設定
WinGetTitle, xmptitle , ahk_class XMPLAY-MAIN
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;メニュー定義
Menu, xmpc, Add, playpause_p , xmsendkey
Menu, xmpc, Add, stop_P , xmsendkey
Menu, xmpc, Add, previous_{PGUP} , xmsendkey
Menu, xmpc, Add, next_{PGDN} , xmsendkey
;Menu, xmpc, Add, seekback, xmsendkey
;Menu, xmpc, Add, seekforward, xmsendkey
;Menu, xmpc, Add, open, xmsendkey
Menu, xmpc, Add, playlist_{F5}, xmshowandsendkey
Menu, xmpc, Add, option_{F9} , xmshowandsendkey
;Menu, xmpc, Add, volumeup
;Menu, xmpc, Add, volumedown
Menu, xmpc, Add, volume
Menu, xmpc, Add
;Menu, xmpc, Add, launch_xmplayer
Menu, xmpc, Add, open_folder
IfWinNotExist , ahk_class XMPLAY-MAIN ;起動してない
Menu, xmpc, Add , launch_xmplay
else ;起動してる
Menu, xmpc, Add, %xmptitle% ,show_xmplay
Menu, xmpc, Add, xmhide
Menu,xmpc,Show,300,200
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;ラベル
launch_xmplay:
run,%xmpc_scriptdir%\xmplay.exe
return
show_xmplay:
WinShow , ahk_class XMPLAY-MAIN ;xmplayを表示
WinActivate , ahk_class XMPLAY-MAIN
return
volume:
Hotkey, UP , volumeup,
Hotkey, DOWN , volumedown,
MsgBox, XMPlay Volume Control ;okが押されるまで待機
Hotkey, UP , OFF,
Hotkey, DOWN , OFF,
return
volumeup:
controlsend,,{NumpadAdd} ,ahk_class XMPLAY-MAIN
return
volumedown:
controlsend,,{NumpadSub} ,ahk_class XMPLAY-MAIN
return
open_folder:
xmplayfolder = ""
FileSelectFolder,xmplayfolder,D:\music,0,Select Folder To Play
if (xmplayfolder != "")
{
run,%xmpc_scriptdir%\xmplay.exe "%xmplayfolder%"
WinWait,ahk_class XMPLAY-MAIN
}
return
xmshowandsendkey:
gosub show_xmplay
StringSplit, splittedbyub, A_ThisMenuItem , _ ;ラベル名をアンダーバーで切断
controlsend,,%splittedbyub2% , ahk_class XMPLAY-MAIN
return
xmsendkey:
StringSplit, splittedbyub, A_ThisMenuItem , _ ;ラベル名をアンダーバーで切断
controlsend,,%splittedbyub2% , ahk_class XMPLAY-MAIN
xmhide:
WinHide , ahk_class XMPLAY-MAIN ;ウィンドウを隠す
return
;;;;;;;;;;;;;;;;;;;;;;;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment