作者PHP5 (Powered by Zend Engine2)
看板EzHotKey
標題[AHK-] Run 能不能放在 function裡?
時間Tue Jan 6 16:51:21 2009
初學 AHK ,想寫一個function 如下
把判斷IfWinExist, Run 函式化
RunOnce (ProgPath, Title="")
{
if (Title!="")
{
IfWinExist Title
{
WinActivate
return
}
}
Run ProgPath
}
#s:: RunOnce (sndvol32, Volume Control)
但是不work
不知道要怎樣才能達到我的要求?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.250.220
※ 編輯: PHP5 來自: 140.112.250.220 (01/06 16:52)
> -------------------------------------------------------------------------- <
作者: Lumania (小糠榔) 看板: EzHotKey
標題: Re: [AHK-] Run 能不能放在 function裡?
時間: Tue Jan 6 16:58:51 2009
※ 引述《PHP5 (Powered by Zend Engine2)》之銘言:
: 初學 AHK ,想寫一個function 如下
: 把判斷IfWinExist, Run 函式化
: RunOnce (ProgPath, Title="")
: {
: if (Title!="")
: {
: IfWinExist Title
: {
: WinActivate
: return
: }
: }
: Run ProgPath
: }
: #s:: RunOnce (sndvol32, Volume Control)
: 但是不work
: 不知道要怎樣才能達到我的要求?
改了一下
RunOnce(ProgPath, Title="")
{
if(Title!="")
{
IfWinExist, %Title%
{
WinActivate, A
return
}
}
Run, %ProgPath%
}
#s:: RunOnce("sndvol32", "Volume Control")
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.69.13.1
※ 編輯: Lumania 來自: 203.67.27.182 (01/06 21:20)
推 PHP5:ok 感謝 !! , A <----是筆誤嗎? 01/07 10:45
→ Lumania:A 不是筆誤 是代表active window 的意思 改成%Title% 好了 01/08 13:39