user interface - Multiple GUIs not launching from AutoHotKey -
i trying automate process of generating template request medical exams our outsourced provider. there 6 guis in script:
- special instructions
- list upcoming appointments
- contact information
- power of attorney listed?
- electronic or hard-copy file?
- authorization number , effective date range
each gui asks user pick 1 choice or other, , based on answers, pastes block of text in template.
the first gui special instructions runs fine. instead of proceeding second gui, script ends. used scite4 editor try see what's going on, , after first gui runs, skips end.
here's code first 2 guis , end:
;special instructions gui ;gui, add, text, w400 h40, special instructions? gui, add, radio, vspecinstrs checked, yes gui, add, radio, , no gui, add, edit, w370 r4 vlistofinstrs, gui, add, button, vbuttonnext1 gnextselected1, next gui, add, button, xp+60 vbuttoncancel1 gcancelselected1, cancel gui, show, w400 h150, special instructions? return ; nextselected1: gui, submit, ; save input user each control's associated variable. if specinstrs = 1 { sendinput >{space 2}>{space 2}>{space 2}>{space 2}>{space 2}important{!}{space 2}<{space 2}<{space 2}<{space 2}<{space 2}< send {enter 2} sendinput %listofinstrs% send {enter 2} } else if specinstrs = 2 { send {enter 2} } specinstrs = 0 filetype = gui, destroy ;return ; ; actions on cancel or close ; cancelselected1: ;guiclose: ;exitapp gosub, guiclose ;return ;upcoming appointments gui gui, add, text, center w200 h50, upcoming appointments? gui, add, radio, vappts checked, yes gui, add, radio, , no gui, add, button, vbuttonnext2 gnextselected2, next gui, add, button, xp+60 vbuttoncancel2 gcancelselected2, cancel gui, show, , appointments return ; nextselected2: gui, submit, ; save input user each control's associated variable. if appts = 1 { sendinput >{space 2}>{space 2}>{space 2}>{space 2}>{space 2}future appointments - not schedule on date{(}s{)}{space}<{space 2}<{space 2}<{space 2}<{space 2}< send {enter 2} sendinput {[}copy , paste appointments cprs here{]} send {enter 2} sendinput >{space 2}>{space 2}>{space 2}>{space 2}>{space 2}<{space 2}<{space 2}<{space 2}<{space 2}< send {enter 2} } else if appts = 2 { send appointments pending: none send {enter 2} } gui, destroy appts = 0 return ; ; actions on cancel or close ; cancelselected2: gosub, guiclose ;guiclose: ;exitapp return
the code never gets upcoming appointments gui. in running debugger, after select next button, skips end code:
; ; guiclose: exitapp return
i'd paste rest of code, figure if can figure out how make gui 2 run after gui 1, can make others work. (besides, if can't gui 2 run, cares rest?!). appreciate help!
there seems major misunderstanding return
keyword you: autohotkey starts executing top of script until first return
occurs. after that, only hotkeys, hotstrings, functions and, importantly you, labels may follow.
some random autohotkey script might following:
#noenv sendmode, input setworkingdir, %a_workingdir% gui, 1:add, button, gbuttonpressed, press me gui, 1:show return ; random commands here never executed, if not enclose in labe, hotkey etc! buttonpressed: gui, 1:destroy msgbox, hi! gosub, secondgui_start return secondgui_start: gui, 2:add, text,, gui show after first 1 gui, 2:show return 2guiclose: exitapp return
back script.
when pressing button associated variable buttonnext
, label nextselected1
being called. ends
gui, destroy return
, expect someting happen afterwards! tell compiler want move on next gui before return
. otherwise, script becomes idle, , since don't have neither hotkeys nor hotstrings nor #persistent
keyword attached, script terminates.
do using goto
keyword. if put second gui in own label, can call way then.
finally, if want manage multiple guis, number them, did in example above.
Comments
Post a Comment