顯示廣告
隱藏 ✕
看板 EZsoft
作者 tingyun (tingyun60426.bbs@ptt.cc)
標題 [轉寄]Re: [請問] 有甚麼撥放器可以用快捷鍵撥放不同音效擋?
時間 2011年03月31日 Thu. AM 08:08:01


※ 本文轉寄自 tingyun60426.bbs@ptt.cc

看板 EZsoft
作者 frank38 (:~)
標題 Re: [請問] 有甚麼撥放器可以用快捷鍵撥放不同音效擋?
時間 Wed Mar 30 14:04:18 2011



簡單的用 ahk 寫一個,不過沒有做什麼檢查,例如熱鍵是否重複...

可以自己設定熱鍵播放聲音檔,也可以使用複合鍵 (Alt、Ctrl、Shift)

程式會自行產生一個 info.ini 檔

用來儲存設定的資訊(聲音檔路徑、熱鍵),必需與主程式放在同一個目錄下


有兩個地方沒有斷行,需要注意一下

或直接下載:http://www.mediafire.com/?78ws5no250zcqi5


==================================

#SingleInstance Force

Gui, Font, s9
Gui, Add, Text, x12, Label
Gui, Add, Text, x+60, File
Gui, Add, Text, x+250, HotKey
Gui, Add, Edit, x12 ys+15 w70
Gui, Add, Edit, x+10 ys+15 w200 +ReadOnly,
Gui, Add, Button,x+10 ys+13 gBrowse, Browse
Gui, Add, HotKey, x+12 ys+15 w80, vHK gLabel
Gui, Add, Button, x+12 ys+13 gSave, Save
Gui, Add, Button, x+12 ys+13 gdel, Delete
;---- 下面是同一行
Gui, Add, ListView, x12 h240 w530 gEdit +AltSubmit -Multi +Grid,
     Label|File|HotKey
;---- 上面是同一行
Gui, Show, h300 w550 , Sound Play
Gosub, ReloadFile
Return

Browse:
;---- 下面是同一行
        FileSelectFile, SelectedFile, 3, , Select a file, Sound File
(*.mp3;*.wav;*.wma)
;---- 上面是同一行
        if SelectedFile =
                Return
        Else
                GuiControl, , Edit2, %SelectedFile%
Return

Save:
        GuiControlGet, path, , Edit2
        GuiControlGet, lb, , Edit1
        GuiControlGet, hk, , msctls_hotkey321
        if(strLen(path) == 0 || strLen(lb) == 0 || StrLen(hk) == 0)
        {
                MsgBox, error...
                Return
        }
        IniWrite, %path%, info.ini, %lb%, Path
        IniWrite, %hk%, info.ini, %lb%, Hotkey
        Gosub, ReloadFile
Return

Edit:
        Gui, submit, NoHide
        ControlGet, selectedItem, List, Selected, SysListView321
        StringSplit, items, selectedItem, %A_Tab%
        GuiControl, , Edit1, %items1%
        GuiControl, , Edit2, %items2%
        IniRead, hk, info.ini, %items1%, Hotkey
        GuiControl, , msctls_hotkey321, %hk%
Return

ReloadFile:
        LV_Delete()
        IniRead, SectionsList, info.ini
        Loop, Parse, SectionsList, n,r
        {
                IniRead, path, info.ini, %A_LoopField%, Path
                IniRead, hk, info.ini, %A_LoopField%, Hotkey
                Hotkey, %hk%, RunScript, On
                StringReplace, sHK, hk, +, Shift +
                StringReplace, sHK, sHK, ^, Ctrl +
                StringReplace, sHK, sHK, !, Alt +
                LV_Add("", A_LoopField, path, sHK)
        }
        LV_ModifyCol()
Return

RunScript:
        IniRead, SectionsList, info.ini
        Loop, Parse, SectionsList, n,r
        {
                IniRead, path, info.ini, %A_LoopField%, Path
                IniRead, hk, info.ini, %A_LoopField%, Hotkey
                if(hk == A_ThisHotkey) {
                        SoundPlay, %path%
                }
        }
Return

del:
        Loop % LV_GetCount()
        {
                LV_GetText(RetrievedText,A_Index)
                GuiControlGet, target, , Edit1
                if instr(RetrievedText, target)
                {
                        LV_Delete(A_Index)
                        IniDelete, info.ini, %target%
                }
        }
Return

GuiClose:
        ExitApp
Return

=============================

懶得上註解..


--

  承諾就像 幹伶XX
    常說,但通常做不到

--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.29.150.125
DCaty:push1F 03/30 22:48


--
※ 看板: EZsoft 文章推薦值: 0 目前人氣: 0 累積人氣: 324 
分享網址: 複製 已複製
r)回覆 e)編輯 d)刪除 M)收藏 ^x)轉錄 同主題: =)首篇 [)上篇 ])下篇