這是我的工作代碼,以防萬一這可以幫助其他人!ahk熱鍵配置文件
#Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance FORCE
GUI, Add, Radio, vInventoryCompare, Compare Inventories
GUI, Add, Radio, vProductionSheet, Production Spreadsheet Stuff
GUI, Add, Radio, vInventorySheet, Inventory Sheet Stuff
GUI, Add, Radio, vStop, Disable Hotkeys
GUI, Add, Button, default xm, Set ; xm puts it at the bottom left corner.
GUI, Show
ButtonSet:
GUI, Submit, NoHide
Return
Insert:: ; paste values
send, {alt}hvv
return
; ----------------------------------
Home::
If InventoryCompare = 1 ; font size up 3 times
{
Send, {enter}{up}
Loop 3
{
Send, {alt}hfg
}
return
}
Else If ProductionSheet = 1 ; Recheck
{
Send, {enter}{up}
Send, {alt}hfc{down 7}{right 3}{enter}
Send, {F2}{left 5}
Send, R-{enter}{up}
return
}
Else If Stop = 1
{
send {Home}
Return
}
Return
; ----------------------------------
End::
If InventoryCompare = 1 ; autocounter for bcg
{
Sendraw, =SUMIF($A$8:$A$38,A3,$F$8:$F$38)
send {enter}
return
}
Else If ProductionSheet = 1 ; discard
{
Send, D{enter}{up}
Send, ^b
return
}
Else If InventorySheet = 1 ; write ok+ and tab
{
send {tab}
Sendraw, ok+
send {tab}
return
}
Else If Stop = 1
{
send {end}
Return
}
Return
; ----------------------------------
PgUp::
If InventoryCompare = 1 ; green bg with white text
{
Send, {alt}hh{down 6}{right 5}{enter} ; bg green
Send, {alt}hfc{down}{left 4}{enter} ; font white
return
}
Else If ProductionSheet = 1 ; ok+ coloring
{
Send, {enter}{up}
Send, {alt}hfc{down 7}{right}{enter}
return
}
Else If InventorySheet = 1 ; write ok and tab
{
send {tab}
Sendraw, ok
send {tab}
return
}
Else If Stop = 1
{
send {PgUp}
Return
}
Return
; ----------------------------------
PgDn::
If InventoryCompare = 1 ; red bg with white text
{
Send, {alt}hh{down 6}{right}{enter} ; bg red
Send, {alt}hfc{down}{left 4}{enter} ; font white
return
}
Else If ProductionSheet = 1 ; ok- coloring
{
Send, {enter}{up}
Send, {alt}hfc{down 7}{left 3}{enter}
return
}
Else If InventorySheet = 1 ; write ok- and tab
{
send {tab}
Sendraw, ok-
send {tab}
return
}
Else If Stop = 1
{
send {PgDn}
Return
}
Return
; ----------------------------------
PrintScreen::
If InventoryCompare = 1 ; Break merged top cell of old inventories
{
send {F2} ; enter cell
sleep 200
send +{left 50} ; select name
sleep 200
send ^x ; cut name
sleep 200
send {enter}{up} ; reselect cell
sleep 200
send {alt}hmu ; break merged cells
sleep 200
send {down}{f2}^v{enter} ; paste name
return
}
Else If Stop = 1
{
send {PrintScreen}
Return
}
Return
GuiClose:
ExitApp
老問題: 我有3套,我想使用具有單選按鈕(或其他裝置)的GUI選擇哪個熱鍵組當前處於活動狀態,以合併成單一腳本熱鍵綁定宏。不幸的是,每次運行腳本時,我總是收到「重複快捷鍵」錯誤(在結束鍵上,如果有的話)。
我一直在網上搜尋試圖找到某人試圖做同樣的事情,但我什麼都沒有提出。我在正確的軌道上嗎?它甚至有可能嗎?
謝謝你的時間!
GUI, Add, Radio, vInventoryCompare, Compare Inventories
GUI, Add, Radio, vProductionSheet, Production Spreadsheet Stuff
GUI, Add, Radio, vInventorySheet, Inventory Sheet Stuff
GUI, Add, Radio, vDisable, Disable hotkeys
GUI, Show
GuiClose:
ExitApp
IF ErrorLevel
ExitApp
Insert:: ; paste values
send, {alt}hvv
return
IF %vInventoryCompare% = 1
{
End:: ; autocounter for bcg
Sendraw, =SUMIF($A$8:$A$38,A3,$F$8:$F$38)
send {enter}
return
Home:: ; font size up 3 times
Send, {enter}{up}
Loop 3
{
Send, {alt}hfg
}
return
PgUp:: ; green bg with white text
Send, {alt}hh{down 6}{right 5}{enter} ; bg green
Send, {alt}hfc{down}{left 4}{enter} ; font white
return
PgDn:: ; red bg with white text
Send, {alt}hh{down 6}{right}{enter} ; bg red
Send, {alt}hfc{down}{left 4}{enter} ; font white
return
PrintScreen:: ; Break merged top cell of old inventories
send {F2} ; enter cell
sleep 200
send +{left 50} ; select name
sleep 200
send ^x ; cut name
sleep 200
send {enter}{up} ; reselect cell
sleep 200
send {alt}hmu ; break merged cells
sleep 200
send {down}{f2}^v{enter} ; paste name
return
}
IF %vProductionSheet% = 1
{
End:: ; discard
Send, D{enter}{up}
Send, ^b
return
Home:: ; Recheck
Send, {enter}{up}
Send, {alt}hfc{down 7}{right 3}{enter}
Send, {F2}{left 5}
Send, R-{enter}{up}
return
PgUp:: ; ok plus coloring
Send, {enter}{up}
Send, {alt}hfc{down 7}{right}{enter}
return
PgDn:: ; ok minus coloring
Send, {enter}{up}
Send, {alt}hfc{down 7}{left 3}{enter}
return
}
IF %vInventorySheet% = 1
{
End::
send {tab}
Sendraw, ok+
send {tab}
return
PgUp::
send {tab}
Sendraw, ok
send {tab}
return
PgDn::
send {tab}
Sendraw, ok-
send {tab}
return
}
IF %vDisable% = 1
{
}
你知道重複的意思嗎? – 2013-03-01 20:54:01
你真好。是的,我希望那些IF聲明能夠解決這個問題。我不明白爲什麼重複應該是一個問題,如果我可以在任何時候使所有但不活躍的話。 – user1988168 2013-03-01 20:57:35