2013-08-17 52 views
0

我創建了一個複選框,然後創建了一個GUI。但是,我想在同一個GUI中創建另一個複選框,但它告訴我需要在下面的BOLD部分輸入「return」。在GUI中創建複選框

如果我這樣做,我的腳本的其餘部分將停止。基本上,如果用戶選中「是」,那麼我需要該GUI中的第二個GUI。但是如果用戶檢查NO,那麼我想讓熱鍵跳到腳本的其餘部分(這不包括在下面)。

我該怎麼做?

Send, {ENTER} 
gui, font, s14 
gui, add, checkbox, w200 y15 vyesy, YES 
gui, add, checkbox, w200 vnon, NO 
gui, add, button, gfem, continue 
gui, show, w200 h175, GYN EXAM? 
Return 

fem: 
Gui, submit 
Send, {space} 
Sleep, 500 


if non = 1 
{ 
send, {space} 
} 
gui, destroy 
If yesy = 1 
{ 
Send,GYN:{SPACE} 
Progress, m2 b fs14 zh0, Date of LMP, , , Arial 
Inputbox, LMP, LMP 
Progress, Off 
Sleep, 500 
Send,LMP{SPACE}%LMP%,{SPACE} 
Progress, m2 b fs14 zh0, Duration`ndays wks mo , , , Arial 
Inputbox, duration, Duration 
Progress, Off 
Sleep, 500 
Send, Duration{SPACE}%duration%,{SPACE} 
Progress, m2 b fs14 zh0, G_/P_ `nPlease include letters G&P, , , Arial 
Inputbox, gp, G_/P_ 
Progress, Off 
Sleep, 500 
Send,%gp%{SPACE} 

gui, font, s14 
gui, add, checkbox, w115 y15 virreg, Irregular 
gui, add, checkbox, w115 vhflow, Heavy flow 
gui, add, checkbox, w115 vndys, Dysmenorrhia 
gui, add, checkbox, w115 y15 x+8 vreg, Regular 
gui, add, checkbox, w150 y+9 vflow, Normal flow 
gui, add, checkbox, w200 y+9 vdysmenorrhia, No Dysmenorrhia 
gui, Add, button, x120 y130 gGyYN, continue 
gui, Show, w400 h200, GYN 
return 


GYyN: 
gui, Submit 
SEND,{space} 
Sleep, 500 

if irreg = 1 
{ 
    send, -{space}Irregular{space} 
Progress, m2 b fs14 zh0, Further details of `nirregular flow, , , Arial 
Inputbox, irf, Irregular flow details 
Progress, Off 
Sleep, 500 
Send,%irf% 

} 
if hflow = 1 
{ 
    send, -{SPACE}Heavy flow{space} 
Progress, m2 b fs14 zh0, Further details of `nheavy flow, , , Arial 
Inputbox, hfl, Heavy flow details 
Progress, Off 
Sleep, 500 
Send,%hfl% 
} 
if ndys = 1 
{ 
    send, -{space}Dysmenorrhia{space} 
Progress, m2 b fs14 zh0, Further details of `ndysmenorrhia, , , Arial 
Inputbox, dysmni, Dysmenorrhia details 
Progress, Off 
Sleep, 500 
Send,%dysmni% 
    - Normal flow- No Dysmenorrhia 
} 
if reg = 1 
{ 
    send, -{space}Regular 
} 
if flow = 1 
{ 
    send, -{space}Normal flow 
} 
if dysmenorrhia = 1 
{ 
    send, -{SPACE}No Dysmenorrhia 
**return** 
}} 
gui, destroy 
+0

(如果我的語言標記出錯,請編輯您的問題) – Mat

+0

誰告訴你在哪裏插入回報?如果是AHK解釋器,那麼如果您提供錯誤消息將會很有幫助。不管怎樣,你通常應該用'return'來完成子例程,也就是說,最後一個命令應該是一個**無條件的**'return'。將'return'放在當前位置下兩行,就在'gui,destroy'的正上方。目前,只有'痛經'(我認爲你有拼寫錯誤)等於* 1 *才能達到'返回'。而且,在相同的條件之後,還有一個'}'太多了。 – MCL

+0

也許你應該給你的腳本一些簡短的描述,第一印象可能會相當令人不安,特別是如果你不準備... – MCL

回答

0

AHK不喜歡打開該 如果yesy = 1個 塊內的第二GUI。如果你這樣寫,錯誤就會消失。

Send, {ENTER} 
gui, font, s14 
gui, add, checkbox, w200 y15 vyesy, YES 
gui, add, checkbox, w200 vnon, NO 
gui, add, button, gfem, continue 
gui, show, w200 h175, GYN EXAM? 
Return 

fem: 
Gui, submit 
Send, {space} 
Sleep, 500 

gui, destroy 

if non = 1 
{ 
send, {space} 
} 

If yesy <> 1 
    return 


Send,GYN:{SPACE} 
Progress, m2 b fs14 zh0, Date of LMP, , , Arial 
Inputbox, LMP, LMP 
Progress, Off 
Sleep, 500 

Send,LMP{SPACE}%LMP%,{SPACE} 
Progress, m2 b fs14 zh0, Duration`ndays wks mo , , , Arial 
Inputbox, duration, Duration 
Progress, Off 
Sleep, 500 

Send, Duration{SPACE}%duration%,{SPACE} 
Progress, m2 b fs14 zh0, G_/P_ `nPlease include letters G&P, , , Arial 
Inputbox, gp, G_/P_ 
Progress, Off 
Sleep, 500 

Send,%gp%{SPACE} 

gui, font, s14 
gui, add, checkbox, w115 y15 virreg, Irregular 
gui, add, checkbox, w115 vhflow, Heavy flow 
gui, add, checkbox, w115 vndys, Dysmenorrhia 
gui, add, checkbox, w115 y15 x+8 vreg, Regular 
gui, add, checkbox, w150 y+9 vflow, Normal flow 
gui, add, checkbox, w200 y+9 vdysmenorrhia, No Dysmenorrhia 
gui, Add, button, x120 y130 gGyYN2, continue 
gui, Show, w400 h200, GYN 
return 


GYyN2: 
gui, Submit 
SEND,{space} 
Sleep, 500 

if irreg = 1 
{ 
    send, -{space}Irregular{space} 
Progress, m2 b fs14 zh0, Further details of `nirregular flow, , , Arial 
Inputbox, irf, Irregular flow details 
Progress, Off 
Sleep, 500 
Send,%irf% 

} 

if hflow = 1 
{ 
    send, -{SPACE}Heavy flow{space} 
Progress, m2 b fs14 zh0, Further details of `nheavy flow, , , Arial 
Inputbox, hfl, Heavy flow details 
Progress, Off 
Sleep, 500 
Send,%hfl% 
} 

if ndys = 1 
{ 
    send, -{space}Dysmenorrhia{space} 
Progress, m2 b fs14 zh0, Further details of `ndysmenorrhia, , , Arial 
Inputbox, dysmni, Dysmenorrhia details 
Progress, Off 
Sleep, 500 
Send,%dysmni% 
    - Normal flow- No Dysmenorrhia 
} 

if reg = 1 
{ 
    send, -{space}Regular 
} 

if flow = 1 
{ 
    send, -{space}Normal flow 
} 

if dysmenorrhia = 1 
{ 
    send, -{SPACE}No Dysmenorrhia 

} 

gui, destroy 
+0

謝謝你。如果非= 1,我希望它跳過它下面的所有內容,並繼續執行腳本的其餘部分:SEND,{ENTER}發送,過敏:{空格} gui,字體,s14 gui,添加,複選框,vNKDA,NKDA gui,add,checkbox,vproblist,查看問題列表gui,添加,按鈕,g過濾器,繼續gui,顯示,w200 h150,過敏返回過敏:gui,提交SEND,{空間}睡眠,500如果NKDA = 1 {發送, - {space} NKDA} if problist = 1 {發送, - {空間}查看問題列表} Gui,銷燬發送,{空間}進度,m2 b fs14 zh0,列出其他過敏症或按Enter ... 我該怎麼辦那? – AP0121