这是我的工作代码,以防万一这对其他人有帮助!
#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 将它们整合到一个脚本中,以选择当前处于活动状态的热键集。不幸的是,每次我运行脚本时,我都会不断收到“重复热键”错误(在 End 键上,如果这告诉你什么的话)。
我一直在网上搜寻,试图找到尝试同样事情的人,但我一无所获。我在正确的轨道上吗?甚至可能吗?
谢谢你的时间!
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
{
}