Jump to content

AutoIt Error Handler


jennico
 Share

Recommended Posts

Finally - No more ugly Error Messages while running scripts !

the idea is simple: put the "launcher" to top of your script and your individual _OnAutoitError() function to the bottom.

It works with scource .au3 scripts as well as with compiled .exes.

;#=#INDEX#==================================================================#
;#  Title .........: AutoIt3 Error Handler                                  #
;#  Date ..........: 4.9.08                                                 #
;#  Author ........: jennico (jennicoattminusonlinedotde)                   #
;#==========================================================================#

;############################################################################
;   1st part (launcher) copy in first line of your program
;############################################################################
#region;-------launcher
If StringInStr($cmdlineraw,"*")=0 Then
    Opt("TrayIconHide",1)
    If @Compiled Then
        $x=Run(@ScriptName&" *")
    Else
    ;   $x=Run("Autoit3.exe "&@ScriptFullPath&" *")
        $x=Run('"Autoit3.exe" "'&@ScriptFullPath&'" *')
    EndIf
    ProcessWait($x,5)
    While ProcessExists($x)
        If WinActive("AutoIt Error") Then _OnAutoItError(WinGetText("AutoIt Error"))
        Sleep(20)
    WEnd
    Exit
EndIf
#endregion;-------launcher
;############################################################################
;   end 1st part (launcher) now comes your program
;############################################################################






#region;-------------user script start

GUICreate(" AutoIt Error Handler Example Script  ©  2008 by jennico")
    GUICtrlCreateLabel("This script is just an example."&@CRLF&@CRLF& _
        "It will produce a syntax error in",25,25,300,50)
    $label=GUICtrlCreateLabel("20",25,85,50,40)
        GUICtrlSetColor(-1,0xF20000)
        GUICtrlSetFont(-1,30,1000)
    GUICtrlCreateLabel("seconds"&@CRLF&@CRLF& _
        "and result in an INDIVIDUAL error message.",25,150,300,50)
    GUICtrlCreateLabel("I hope you find it useful !"&@CRLF&@CRLF&"j.",25,220,300,80)
GUISetState()

For $i=19 To 0 Step -1
    Sleep(1000)
    GUICtrlSetData($label,$i)
Next

MsgBox(0,"" ; this is meant to produce an error !

Do
    $msg=GUIGetMsg()
Until $msg=-3

#region;-------------user script end






;############################################################################
;   2nd part (error func) copy and individualize to the end of your program
;############################################################################
#region;-------errorfunc
;   MadExcept option
Func _OnAutoItError($txt)
    Send("{ENTER}")
    GUICreate(@ScriptName,385,90)
    GUISetIcon("")
    GUISetBkColor(0xE0DFE2)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",1,1,383,1),0x41689E)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",1,88,383,1),0x41689E)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",1,1,1,88),0x41689E)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",383,1,1,88),0x41689E)
        GUICtrlCreateIcon("user32.dll",103,11,11,32,32)
        GUICtrlSetBkColor(GUICtrlCreateLabel("An error occurred in the application.",52,22,175,15),-2)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",10,60,110,22),0x706E63)
            GUICtrlSetState(-1,128)
        $send=GUICtrlCreateLabel("   send bug report",28,64,92,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetColor(-1,0xFFFFFF)
            GUICtrlSetCursor(-1,0)
        $sen=GUICtrlCreateIcon("shell32.dll",25,13,63,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",124,60,114,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $show=GUICtrlCreateLabel("   show bug report",143,64,95,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $sho=GUICtrlCreateIcon("shell32.dll",23,127,63,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",246,8,131,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $cont=GUICtrlCreateLabel("   continue application",265,12,115,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $con=GUICtrlCreateIcon("shell32.dll",290,249,11,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",246,34,131,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $rest=GUICtrlCreateLabel("    restart application",265,38,115,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $res=GUICtrlCreateIcon("shell32.dll",255,249,37,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",246,60,131,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $close=GUICtrlCreateLabel("     close application",265,64,115,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $clos=GUICtrlCreateIcon("shell32.dll",240,249,63,16,16)
            GUICtrlSetCursor(-1,0)
    GUISetState()
    WinSetOnTop(@ScriptName,"",1)
    Do
        $msg=GUIGetMsg()
        If $msg=$cont Or $msg=$con Then MsgBox(270400,"Continue Application", _
            "I am afraid, not possible with AutoIt !     ")
        If $msg=$show Or $msg=$sho Then MsgBox(270400,"Show Bug Report",$txt)
        If $msg=$send Or $msg=$sen Then
            ;#include <INet.au3>    ;   use email
            ;_INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress [,$s_Subject&_
            ;[,$as_Body [,$s_helo, [,$s_first [,$b_trace]]]]])
            MsgBox(270400,"Send Bug Report","Email successfully sent !     ")
        EndIf
    Until $msg=-3 Or $msg=$close Or $msg=$clos Or $msg=$rest Or $msg=$res
    If $msg=$rest Or $msg=$res Then
        If @Compiled Then
            $x=Run(@ScriptName)
        Else
        ;   $x=Run("Autoit3.exe "&@ScriptFullPath)
            $x=Run('"Autoit3.exe" "'&@ScriptFullPath&'"')
        EndIf
    EndIf
    Exit
EndFunc
;   apologize option
Func _OnAutoItError1($txt)
    Send("{ENTER}")
    MsgBox(270336," :-(      So Sorry  ---  Individual Error Message","Script  <"& _
        @ScriptName&">  terminated."&@CRLF&@CRLF&"Error Message:"&@CRLF&@CRLF& _
        $txt&@CRLF&@CRLF&"The Author deeply apologizes for the inconvenience !"&@CRLF&@CRLF)
    ; or make a logfile or restart the script or whatever ......
    Exit
EndFunc
#endregion;-------errorfunc
;############################################################################
;   end 2nd part (error func)
;############################################################################

Someone who has time could make an automatic debugger / patcher out of it. (?)

Please tell me if you like the trick !

j.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

Hmm that's pretty cool! ;)

It gives an error almost instantaneously, I don't know if that was intended.

But this is indeed much better than built error msgbox, I always thought it could be so much more useful, and user friendly.

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

I must be a little dense I was thinking _OnAutoItError() was called internally after an error has occured by AutoIt, that's a shame. It'd be nice to have something like MadExcept for AutoIt.

Still it's a good start. Thanks jennico.

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

uups,

did i make an error ? my line works fine for me !

what's the difference between:

$x=Run('"' & 'Autoit3.exe" "' & @ScriptFullPath & '" *')

and

$x=Run("Autoit3.exe "&@ScriptFullPath&" *")

?

for me both lines work the same.

funny.... (?)

no matter, i will change the code above....

sorry j.

Edit: fixed the line, sorry... and thx a lot for the comments

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

i looked at MadExcept (thx for the link)

Posted Image

with the exception of "continue application" this could easily be realized....

you could implement the option that the user can send you the error report automatically...

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

Sorry, should have clarified. In your original line, if the path to the script or scriptfile name has spaces, AutoIt3.exe cannot find the file to launch it. Hence wrapping it in quotes.

EDIT -

Actually, I suppose you could drop the quotes around AutoIt3.exe and make it

$x=Run('Autoit3.exe "'&@ScriptFullPath&'" *')
Edited by wraithdu
Link to comment
Share on other sites

Nice idea.

There is more elegant way of doing it...

#NoTrayIcon

_AutoItErrorHandler()

MsgBox(0, "" ;This is meant to produce an error !


Func _AutoItErrorHandler()
    If StringInStr($CmdLineRaw, "/AutoIt3ExecuteScript") Then Return
    
    Local $sErrorMsg = ""
    Local $sRunLine = @AutoItExe & ' /ErrorStdOut /AutoIt3ExecuteScript "' & @ScriptFullPath & '"'
    
    Local $iPID = Run($sRunLine, @ScriptDir, 0, 2 + 4)
    ProcessWait($iPID)
    
    While 1
        $sErrorMsg &= StdoutRead($iPID)
        If @error Then ExitLoop
        
        Sleep(1)
    WEnd
    
    If $sErrorMsg = "" Then Exit
    
    MsgBox(262144+48, "AutoIt3 Error Message", _
        StringFormat("Program Terminated <%s>.\n\nError Message:\n\n%s\n\n" & _
            "Please report about this bug to the author, sory for the inconvenience! :(", @ScriptName, $sErrorMsg))
    
    Exit
EndFunc

;)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

well, then it works for me because i have no spaces in my scriptdir. good to know ! of course your line is better then ! thx.

i made myself work a little bit on the MadExcept Box.

here is the result:

;   MadExcept option
Func _OnAutoItError($txt)
    Send("{ENTER}")
    GUICreate(@ScriptName,385,90)
    GUISetIcon("")
;   GUISetBkColor(0x41689E)
    GUISetBkColor(0xE0DFE2)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",1,1,383,1),0x41689E);0xFCFDFE)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",1,88,383,1),0x41689E)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",1,1,1,88),0x41689E)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",383,1,1,88),0x41689E)
        GUICtrlCreateIcon("user32.dll",103,11,11,32,32)
        GUICtrlSetBkColor(GUICtrlCreateLabel("An error occurred in the application.",52,22,175,15),-2)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",10,60,110,22),0x706E63)
            GUICtrlSetState(-1,128)
        $send=GUICtrlCreateLabel("   send bug report",28,64,92,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetColor(-1,0xFFFFFF)
            GUICtrlSetCursor(-1,0)
        $sen=GUICtrlCreateIcon("shell32.dll",25,13,63,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",124,60,114,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $show=GUICtrlCreateLabel("   show bug report",143,64,95,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $sho=GUICtrlCreateIcon("shell32.dll",23,127,63,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",246,8,131,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $cont=GUICtrlCreateLabel("   continue application",265,12,115,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $con=GUICtrlCreateIcon("shell32.dll",290,249,11,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",246,34,131,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $rest=GUICtrlCreateLabel("    restart application",265,38,115,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $res=GUICtrlCreateIcon("shell32.dll",255,249,37,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",246,60,131,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $close=GUICtrlCreateLabel("     close application",265,64,115,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $clos=GUICtrlCreateIcon("shell32.dll",240,249,63,16,16)
            GUICtrlSetCursor(-1,0)
    GUISetState()
    WinSetOnTop(@ScriptName,"",1)
    Do
        $msg=GUIGetMsg()
        If $msg=$cont Or $msg=$con Then MsgBox(270400,"Continue Application", _
            "I am afraid, not possible with AutoIt !     ")
        If $msg=$show Or $msg=$sho Then MsgBox(270400,"Show Bug Report",$txt)
        If $msg=$send Or $msg=$sen Then
            ;#include <INet.au3>    ;   use email
            ;_INetSmtpMail ( $s_SmtpServer, $s_FromName,  _                                             ;$s_FromAddress, $s_ToAddress [,$s_Subject& _
            ;[,$as_Body [,$s_helo, [,$s_first [,$b_trace]]]]])
            MsgBox(270400,"Send Bug Report","Email successfully sent !     ")
        EndIf
    Until $msg=-3 Or $msg=$close Or $msg=$clos Or $msg=$rest Or $msg=$res
    If $msg=$rest Or $msg=$res Then
        If @Compiled Then
            $x=Run(@ScriptName)
        Else
            $x=Run('"Autoit3.exe" "'&@ScriptFullPath&'"')
        EndIf
    EndIf
    Exit
EndFunc

the gui needs a better style, and in a script u could fileinstall better labels. my icons are just from the system.

nice, no ?

;)

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

@MrCreatoR

thank you for your sample ! that's what i attempted at first !

yesterday i presumed in the support forum that the stderr stream could be used for that, but i could not make it work and nobody answered.

now i know !

j ;)

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

THANKS !!!!!

tomorrow i write a new version from MrCreatoR's wonderful idea. all can be put in one function.

it's a pity it cannot be put in an include file as an udf, and neither a macro.

so it will have to stay just a function to be copied into the script.

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

yes of course the code is free !!!!!!!!!!

i would love to see more ideas on this. could become a very creative inspirating thread.

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

it's a pity it cannot be put in an include file as an udf

It can! ;)

Hers is an attached zip-file, just run the «AutoItErrorHandler - Example.au3», it's includes the GUI version with options (Send/Show report, Restart/Close App etc.).

AutoItErrorHandler.zip

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Nice !

this would mean that the lines:

Local $sRunLine = @AutoItExe & ' /ErrorStdOut /AutoIt3ExecuteScript "' & @ScriptFullPath & '"'

Local $iPID = Run($sRunLine, @ScriptDir, 0, 2 + 4)

refer to the example script. i thought that @ScriptFullPath would only run the UDF file itself once again. that's why i thought it's not possible.

Again, i learned something !

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

i made the example script once more, with the elegant error handler.

#=#INDEX#==================================================================#
;#  Title .........: AutoIt3 Error Handler                                  #
;#  Date ..........: 5.9.08                                                 #
;#  Authors .......: @MrCreatoR                                             #
;#                   jennico (jennicoattminusonlinedotde)                   #
;#                   MadExcept (GUI inspiration by mrRevoked)               # 
;#==========================================================================#

_OnAutoItError()

GUICreate(" AutoIt Error Handler Example Script  ©  2008 by jennico")
    GUICtrlCreateLabel("This script is just an example."&@CRLF&@CRLF& _
        "It will produce a syntax error in",25,25,300,50)
    $label=GUICtrlCreateLabel("20",25,85,50,40)
        GUICtrlSetColor(-1,0xF20000)
        GUICtrlSetFont(-1,30,1000)
    GUICtrlCreateLabel("seconds"&@CRLF&@CRLF& _
        "and result in an INDIVIDUAL error message.",25,150,300,50)
    GUICtrlCreateLabel("I hope you find it useful !"&@CRLF&@CRLF&"j.",25,220,300,80)
GUISetState()

For $i=19 To 0 Step -1
    Sleep(1000)
    GUICtrlSetData($label,$i)
Next

MsgBox(0,"" ; this is meant to produce an error !

Do
    $msg=GUIGetMsg()
Until $msg=-3


Func _OnAutoItError()
    If StringInStr($CmdLineRaw,"/AutoIt3ExecuteScript") Then Return
    Opt("TrayIconHide",1)
    $iPID=Run(@AutoItExe&' /ErrorStdOut /AutoIt3ExecuteScript "'&@ScriptFullPath&'"',@ScriptDir,0,6)
    ProcessWait($iPID)
    $sErrorMsg=""
    While 1
        $sErrorMsg&=StdoutRead($iPID)
        If @error Then ExitLoop
        Sleep(1)
    WEnd
    If $sErrorMsg="" Then Exit
    GUICreate(@ScriptName,385,90,Default,Default,-2134376448);BitOR($WS_CAPTION,$WS_POPUP,$WS_SYSMENU)
    GUISetBkColor(0xE0DFE2)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",1,1,383,1),0x41689E)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",1,88,383,1),0x41689E)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",1,1,1,88),0x41689E)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",383,1,1,88),0x41689E)
        GUICtrlCreateIcon("user32.dll",103,11,11,32,32)
        GUICtrlSetBkColor(GUICtrlCreateLabel("An error occurred in the application.",52,21,175,15),-2)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",10,60,110,22),0x706E63)
            GUICtrlSetState(-1,128)
        $send=GUICtrlCreateLabel("   send bug report",28,64,92,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetColor(-1,0xFFFFFF)
            GUICtrlSetCursor(-1,0)
        $sen=GUICtrlCreateIcon("shell32.dll",25,13,63,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",124,60,114,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $show=GUICtrlCreateLabel("   show bug report",143,64,95,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $sho=GUICtrlCreateIcon("shell32.dll",23,127,63,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",246,8,131,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $cont=GUICtrlCreateLabel("   continue application",265,12,115,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $con=GUICtrlCreateIcon("shell32.dll",290,249,11,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",246,34,131,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $rest=GUICtrlCreateLabel("    restart application",265,38,115,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $res=GUICtrlCreateIcon("shell32.dll",255,249,37,16,16)
            GUICtrlSetCursor(-1,0)
        GUICtrlSetBkColor(GUICtrlCreateLabel("",246,60,131,22),0xEFEEF2)
            GUICtrlSetState(-1,128)
        $close=GUICtrlCreateLabel("     close application",265,64,115,15)
            GUICtrlSetBkColor(-1,-2)
            GUICtrlSetCursor(-1,0)
        $clos=GUICtrlCreateIcon("shell32.dll",240,249,63,16,16)
            GUICtrlSetCursor(-1,0)
    GUISetState()
    WinSetOnTop(@ScriptName,"",1)
    SoundPlay(@WindowsDir&"\Media\chord.wav")
    Do
        $msg=GUIGetMsg()
        If $msg=$cont Or $msg=$con Then MsgBox(270400,"Continue Application", _
            "I am afraid, not possible with AutoIt !     "&@CRLF&@CRLF& _
            "( No GoTo command )      :-( ")
        If $msg=$show Or $msg=$sho Then MsgBox(270400,"Show Bug Report",$sErrorMsg)
        If $msg=$send Or $msg=$sen Then
            ;#include <INet.au3>    ;   use email
            ;_INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress [,$s_Subject&_
            ;[,$as_Body [,$s_helo, [,$s_first [,$b_trace]]]]])
            MsgBox(270400,"Send Bug Report","Email successfully sent !     ")
        EndIf
    Until $msg=-3 Or $msg=$close Or $msg=$clos Or $msg=$rest Or $msg=$res
    If $msg=$rest Or $msg=$res Then Run(@AutoItExe&' "'&@ScriptFullPath&'"',@ScriptDir,0,6)
    Exit
EndFunc

i encountered a problem when writing the sript. the line "GuiSetStyle()" produces an error when script is compiled. can anyone confirm that this might be an AutoIt Bug, please ?

j.

Edit: NO BUG (anymore)

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

i encountered a problem when writing the sript. the line "GuiSetStyle()" produces an error when script is compiled. can anyone confirm that this might be an AutoIt Bug, please ?

What version you are using? It's ok on 3.2.12.0.

And btw, you don't have to use GuiSetStyle, just set these styles when creating the gui...

GUICreate(@ScriptName, 385, 90, -1, -1, -2134376448)
Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

thx for the info. i still hang to the v 3.2.8.1. i made bad experiences with upgrades in the past. but i will have to do that sooner or later. so no bug.

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

  • 3 months later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...