Loops 循环中的自动热键gui
所以…我做这个已经有一段时间了,但肯定还是很糟糕 总结如下: 我想在单击某些GUI中的特定选项后开始循环的下一次迭代 在我的研究中,我发现循环中没有任何回报。问题是,我不知道如何使这项工作没有回报 请帮忙 谢谢 马克S (修剪!) ` 斯达林:=5Loops 循环中的自动热键gui,loops,user-interface,autohotkey,Loops,User Interface,Autohotkey,所以…我做这个已经有一段时间了,但肯定还是很糟糕 总结如下: 我想在单击某些GUI中的特定选项后开始循环的下一次迭代 在我的研究中,我发现循环中没有任何回报。问题是,我不知道如何使这项工作没有回报 请帮忙 谢谢 马克S (修剪!) ` 斯达林:=5 Loop, 10 { CurrentRow := (StartLine - 1) + A_Index ;*****
Loop, 10
{
CurrentRow := (StartLine - 1) + A_Index ;*****
;----------------***GETTING THE DATA***----------------
ControlFocus,, Proto_Names - Excel
Sleep, 200
oNamesDoc := ComObjActive("Excel.Application")
Global AlertStatus := oNamesDoc.Range("C" CurrentRow).Text
Global AlertQualifier := oNamesDoc.Range("D" CurrentRow).text
Global First := oNamesDoc.Range("H" CurrentRow).text
Global Last := oNamesDoc.Range("I" CurrentRow).text
Global State := oNamesDoc.Range("J" CurrentRow).text
Global Type := oNamesDoc.Range("M" CurrentRow).text
Global HMSStatus := oNamesDoc.Range("P" CurrentRow).text
Global HMSQualifier := oNamesDoc.Range("Q" CurrentRow).text
Global LicenseNo := oNamesDoc.Range("N" CurrentRow).text
Global Scrubbed := oNamesDoc.Range("AB" CurrentRow).value
;----------------***GETTING THE DATA***----------------
;Gui
Gui, 2:Add, Text,x1 y8, Blah Blah
Gui, 2:Add, Button, x1 y40, License
Gui, 2:Add, Button, x80 y40, Name
Gui, 2:Show, , blah blah - Row %CurrentRow% ; Important because it references A_Index
return
2GuiClose:
Gui, 2:Destroy
return
2ButtonLicense:
Gui, 2:Submit
Gui, 2:Destroy
;Another GUI
Gui, 3:Add, Text,x1 y8, Text
Gui, 3:Add, Text,x170 y132, Row %CurrentRow% ;Important because it references A_index
Gui, 3:Add, Button,x1 y125 , blah
Gui, 3:Show, , blah blah
return
3GuiClose:
Gui, 3:Destroy
return
3ButtonAgree:
Gui, 3:Submit
Gui, 3:Destroy
MsgBox, Click OK for Next
continue
}
`
进一步总结:
目标:
循环以下内容:
1.Gui#1:选项a |选项b也希望显示a#U索引
如果选择选项A或B,则转到Gui#2
break
提前退出循环。这就是您试图通过回报实现的目标吗?您可以设置一个返回变量break,然后返回它 澄清后编辑: 我认为最好的方法是将每个gui分离为一个函数,它只运行您在这里使用的循环 有一个主循环和一个全局变量,说明下一个循环输入的内容。
然后每个函数都可以设置这个变量
global NextLoop:=1
main(){
global NextLoop
loop{
if NextLoop == 1 {
gui1()
}else if NextLoop == 2 {
gui2()
} ; etc...
}
}
gui1(){
global NextLoop
loop{
if ; user chooses an option {
NextLoop := 2
return
}
}
}
gui2(){
global NextLoop
loop{
if ; user chooses c {
NextLoop := 1
return
}
if ; user chooses d {
NextLoop := 3
return
}
}
}
}
填写这些代码,它应该会起作用。谢谢你的建议,但我想我已经解决了。查看下面的代码,我将尝试回答任何问题。太漂亮了
LoopTot := (Endline - StartLine) + 1
Loop, %LoopTot% ;***Starts the loop***
{
Global CurrentRow := (StartLine - 1) + A_Index
;----------------***GETTING THE DATA***----------------
ControlFocus,, Proto_Names - Excel
Sleep, 200
oNamesDoc := ComObjActive("Excel.Application")
Global AlertStatus := oNamesDoc.Range("C" CurrentRow).Text
Global AlertQualifier := oNamesDoc.Range("D" CurrentRow).text
Global First := oNamesDoc.Range("H" CurrentRow).text
Global Last := oNamesDoc.Range("I" CurrentRow).text
Global State := oNamesDoc.Range("J" CurrentRow).text
Global Type := oNamesDoc.Range("M" CurrentRow).text
Global HMSStatus := oNamesDoc.Range("P" CurrentRow).text
Global HMSQualifier := oNamesDoc.Range("Q" CurrentRow).text
Global LicenseNo := oNamesDoc.Range("N" CurrentRow).text
Global Scrubbed := oNamesDoc.Range("AB" CurrentRow).value
;----------------***GETTING THE DATA***----------------
Gui, 2:font, s12, Verdana
Gui, 2:Add, Text,x1 y8, %First% %Last% License:%LicenseNo%
Gui, 2:Add, Button, x1 y40, License
Gui, 2:Add, Button, x80 y40, Name
Gui, 2:Show, , Search Options - Row %CurrentRow%
WinWaitClose, Search Options - Row %CurrentRow%
If Var = 1
Continue
If Var = 2
Continue
}
msgbox DONE!
ExitApp
2ButtonLicense:
Var = 1
Gui, 2:Destroy
CALicense1()
LicenseAgreeDisagree()
return
return
2ButtonName:
Var = 2
Gui, 2:Destroy
CAName1()
NameAgreeDisagree()
return
return
嘿,欢迎来到Stack Overlfow!试着把代码简化成一个简短易读的代码段,以演示您的意思。这可能会让你的问题更清楚。谢谢你的欢迎。我把它整理了一下。我还想说,这个问题有点不清楚。是否希望在单击某个元素时再次遍历循环,但在单击其他元素时返回上一个循环的状态?如果是这样,您可能希望尝试创建递归函数而不是循环。很高兴能帮你。嘿,我总结了。请让我知道你的想法。谢谢