Hi
I tried to make my own msgbox with 2 buttons (go_on and stop) in a gui subroutine.
when i'm calling this sub, it creates the GUI and returns.
The script didn't wait for button press (when you use the prefab msgbox it does), because the button_press is another sub.
I had to make a kind of workaround (with initially do = -1 and a loop to check if do > -1) to solve this - but I don't like that code.
My question: is this the correct way, or do you know a better (shorter) sollution ?
Code:
do = -1
;telnet not default installed in Vista #####
telnet:
GoSub, MsgBox_telnet
Loop,
{
if do > -1
break
else
sleep, 100
}
if do = 1
GoSub, telnet_aan
do = -1
return
; #########################################
; GUI input
MsgBox_telnet:
Gui, Add, Button, x42 y102 w90 h30 gGoOn, DOORGAAN
kleur = EEAA99
Gui, Color, %kleur%
WinSet, TransColor, %kleur% 150
Gui, Add, Button, x182 y102 w90 h30 gSTOP, STOPPEN
Gui, Font, S12 CDefault, Verdana
Gui, Add, Text, x42 y22 w250 h80 , Activating telnet opens ports, are you sure ?
Gui, Show, x127 y87 h172 w315, Telnet activation or installation
Return
STOP:
Gui, destroy
do = 0
return
GuiClose:
do = 0
Gui, destroy
return
GoOn:
do = 1
Gui, destroy
Return
; ############## end gui #####################
/*
###################### Run telnet
telnet_aan:
run, telnet,, UseErrorLevel
if ErrorLevel = ERROR
{
Gosub, install_telnet
run, telnet, UseErrorLevel
if ErrorLevel = ERROR
msgbox, unknown error
ErrorLevel =
return
}
return
;######################## Install telnet
install_telnet:
parameter := "control appwiz.cpl,,2"
runwait, %parameter%
sleep, 2000
Loop,
{
WinGet, Check, ControlList, A
If Check contains SysTreeView321
break
tel += 1
sleep, 100
If tel = 80 ; 8 seconden
{
msgbox, telnet installatievenster komt niet
return
}
}
send telnet-client
send {SPACE}
send {ENTER}
sleep, 3000
Loop,
{
WinGet, Check, ControlList, A
If Check contains DirectUIHWND1
sleep, 100
Else
break
}
;##################end telnet
*/