Post by garry » 07 Jul 2018, 15:20
fazer uso de > #Warn (?)
example-1
Code: Select all
OnError("a1",1)
; this is a test on error goto
%e1% = ccc ; << isto está errado
Gui,show,x0 y0 w200 h120 ,TEST
return
Guiclose:
Exitapp
a1(e)
{
aa:= % "ERROR`nError at Line = " e.line "`nWith = " e.extra "`nMessage= " e.message "`nError occured at= " e.what "`nFile= " e.file "`n"
msgbox,%aa%
return true
}
example-2
Code: Select all
#warn ;- para o script inteiro
;---------------------------------
f1:="https://www.websitenotexist.pt" ;- failure - wrong adress
;f1:="http://50.7.70.58:8708/played.html"
xx:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
;ComObjError(false)
;xx.Silent := True ;- script failure = off
;---------------------------------------------
xx.SetTimeouts(500,500,500,500)
;xx.SetTimeouts(1,1,1,1) ;<- failure = The operation timed out
gosub,aa1
return
aa1:
try{
xx.Open("GET",f1)
xx.Send()
aac=
aac:=xx.ResponseText
} catch e {
xxx:=e.Message
msgbox, 262208,ERROR,Error=`n%xxx%`n----------------minha mensagem--------------------------`nBoa tarde .. xy .. `n
return
}
msgbox, 262208,%f1%,%aac%
return
avoid error
evitar erro
Code: Select all
;- allow only 3 digits and then skip to next edit
Gui, Add, Text,, Number1:
Gui, Add, Edit, gcheck_length vDate1 number limit3,
Gui, Add, Text,, Number2:
Gui, Add, Edit, gcheck_length vDate2 number limit3,
Gui, Add, Button, x10 y425 w80 h30 Default, OK
Gui, Show, x700 y91 h465 w470, TITLE
Return
Guiclose:
exitapp
buttonOK:
Gui, Submit,nohide
msgbox,%date1%`n%date2%
return
check_length:
Gui, Submit, NoHide
if (StrLen(%A_GuiControl%) = 3)
GuiControl, Focus, % "Date" . (SubStr(A_GuiControl, 0) + 1)
return
fazer uso de > #Warn (?)
example-1
[code]
OnError("a1",1)
; this is a test on error goto
%e1% = ccc ; << isto está errado
Gui,show,x0 y0 w200 h120 ,TEST
return
Guiclose:
Exitapp
a1(e)
{
aa:= % "ERROR`nError at Line = " e.line "`nWith = " e.extra "`nMessage= " e.message "`nError occured at= " e.what "`nFile= " e.file "`n"
msgbox,%aa%
return true
}
[/code]
example-2
[code]
#warn ;- para o script inteiro
;---------------------------------
f1:="https://www.websitenotexist.pt" ;- failure - wrong adress
;f1:="http://50.7.70.58:8708/played.html"
xx:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
;ComObjError(false)
;xx.Silent := True ;- script failure = off
;---------------------------------------------
xx.SetTimeouts(500,500,500,500)
;xx.SetTimeouts(1,1,1,1) ;<- failure = The operation timed out
gosub,aa1
return
aa1:
try{
xx.Open("GET",f1)
xx.Send()
aac=
aac:=xx.ResponseText
} catch e {
xxx:=e.Message
msgbox, 262208,ERROR,Error=`n%xxx%`n----------------minha mensagem--------------------------`nBoa tarde .. xy .. `n
return
}
msgbox, 262208,%f1%,%aac%
return
[/code]
avoid error
evitar erro
[code];- allow only 3 digits and then skip to next edit
Gui, Add, Text,, Number1:
Gui, Add, Edit, gcheck_length vDate1 number limit3,
Gui, Add, Text,, Number2:
Gui, Add, Edit, gcheck_length vDate2 number limit3,
Gui, Add, Button, x10 y425 w80 h30 Default, OK
Gui, Show, x700 y91 h465 w470, TITLE
Return
Guiclose:
exitapp
buttonOK:
Gui, Submit,nohide
msgbox,%date1%`n%date2%
return
check_length:
Gui, Submit, NoHide
if (StrLen(%A_GuiControl%) = 3)
GuiControl, Focus, % "Date" . (SubStr(A_GuiControl, 0) + 1)
return
[/code]