Jump to content

Recommended Posts

Posted (edited)

When I run show-original-line on my script, it maxes a cpu and does so forever. Hope you can help me, script attached.

script.rar

Edited by Jonniy

Thanks for your help & have a good day. Yours sincerely, -Jonniy-  

  • 1 month later...
Posted (edited)

Hello,
I have a problem in windows 8.1.

If I use your error handler then the script crashes when i closes the script.

 

I checked it and it happens in windows 8.1. It also happens to my friend.

I have autoit 3.3.10.2. The problem occurs
also with 3.3.8

v783n5.jpg

 

UPDATE 1:

I found more information that can help to debug the problem.

if i executes this code:

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 284, 191, 280, 174)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$timer = TimerInit()
While 1
    If TimerDiff($timer) > 5000 Then Exit
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

And then i click on the X button or wait 5 seconds then the script will crash.

 

 
However,
if i executes this code:
$timer = TimerInit()
Do
    Sleep(100)
Until TimerDiff($timer) > 5000
Exit

then the script will exit properly after 5 seconds without crash.

 

So This means that the problem happen when some GUI window involved (if you use the script under windows 8.1)

 

 

UPDATE 2:

I have information that can help debug the problem.
 
In _AutoItErrorTrap.au3, if i add Return In the beginning of the function __CBTProc_ErrorTrap($nCode, $wParam, $lParam) so that function will be:
Func __CBTProc_ErrorTrap($nCode, $wParam, $lParam)
    Return
.......
.......
EndFunc

then i Isolate source of the problem. that way if the problem still occurs, then it means that the problem is somewhere in function _AutoItErrorTrap .

and the problem still occurs.

i think that the source of the problem is with the functions DllCallbackRegister or _WinAPI_SetWindowsHookEx or DllCallbackFree

 
Anyway, I found a "workaround" to the problem.
As I said before, that problem occurs when any GUI involved.

So the "workaround" is first delete the GUI and then exit the script.

 

So Instead of:

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 284, 191, 280, 174)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$timer = TimerInit()
While 1
    If TimerDiff($timer) > 5000 Then MsgBox(0,"",)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

the code should be:

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 284, 191, 280, 174)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$timer = TimerInit()
While 1
    If TimerDiff($timer) > 5000 Then MsgBox(0,"",)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Form1) ; Add this ! <-----------------------------
            Exit

    EndSwitch
WEnd

I hope I helped someone

UPDATE 3:

workaround 2 is to replace the Exit to ProcessClose(@ScriptName).

Example:

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 284, 191, 280, 174)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$timer = TimerInit()
While 1
    If TimerDiff($timer) > 5000 Then MsgBox(0,"",)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ProcessClose(@ScriptName) ; <-------------- Instead of Exit
    EndSwitch
WEnd
Edited by Guest
  • 2 weeks later...
  • 2 months later...
  • 7 months later...
Posted

Hello, after being away for some time, this code no longer seems to work. It doesn't seem to be detecting the "AutoIt Error" Window anymore, going to try to dig deeper into the problem, or maybe try to recode the system that does this entirely.

But before I go through the trouble, might anyone be able to point out exactly WHY it's no longer working, otherwise, I'm not sure how I should go about fixing it.

Posted

It seems to work alright for me...maybe I just haven't seen an issue yet though. Which AutoIt version are you using?

My issue is that the "ShowOriginalLine.exe" application doesn't function/stalls. It lists 3 of my includes on compiling with AutoIt3Wrapper and tacks the CPU, but no actual processing takes place as far as I can tell. I've been using the updated script posted on page 5 of this topic. It looks like it stops adding line numbers after my first include - granted, I have many in this project. I'm not sure if there's a limit to the amount of includes or script lines as I'm also doing this to a script with over 18,000 lines.

This is a fantastic idea and I would love for it to work.

  • 6 months later...
Posted
#include "_AutoItErrorTrap.au3"

_AutoItErrorTrap("AutoItErrorTrap", "", True)

_Example()

Func _Example()
    _Example()
EndFunc

 

I know that in this case error can not be trapped, but why the original error window triggered about 5-6 times?

 

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

Posted

This is the problematic code (run it not from SciTE):

#include <WinAPI.au3>

$hCALLBACK = DllCallbackRegister('_CBT_Callback', 'int', 'int;int;int')

If $hCALLBACK Then
    $hWINHOOK = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hCALLBACK), 0, _WinAPI_GetCurrentThreadId())
    
    If Not $hWINHOOK Then
        DllCallbackFree($hCALLBACK)
    EndIf
EndIf

test()

Func test()
    test()
EndFunc

Func _CBT_Callback($nCode, $wParam, $lParam)
    MsgBox(64, @ScriptName, $nCode)
    Return _WinAPI_CallNextHookEx($hWINHOOK, $nCode, $wParam, $lParam)
EndFunc

Strange, but the callback function not triggered at all.

 

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

  • 1 year later...
  • 7 months later...
Posted (edited)

Hey guys... i'm using this UDF and i passed through this problems... here is how to solve it:

just replace this function:

Func __AET_ShutDown()
    If $hAET_USER32 Then DllClose($hAET_USER32)
    If $hAET_WINDOW_PROC Then
        _WinAPI_UnregisterClass($sAET_CLASSNAME, $hAET_INSTANCE)
        DllCallbackFree($hAET_WINDOW_PROC)
    EndIf

    If $hAET_CBTPROC_HOOKERROR Then ;was crashing here
        _WinAPI_UnhookWindowsHookEx($hAET_CBTPROC_HOOKERROR)
        DllCallbackFree($hAET_CBTPROC_CALLBKERROR)
    EndIf

;~  ;----> Clean up resources used by Microsoft Windows GDI+.
    If $hAET_SCR_HBITMAP Then
        _WinAPI_DeleteObject($hAET_SCR_HBITMAP)
        _GDIPlus_Shutdown()
    EndIf
    ;<----
EndFunc   ;==>__AET_ShutDown

 

Edited by x_bennY
  • 5 years 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
×
×
  • Create New...