MrCreatoR Posted December 30, 2008 Share Posted December 30, 2008 Hi,This Include-UDF idea was inspired from Feature Request on Bug Tracking System about a better OnAutoItStart/OnAutoItExit handling. So here it is:Example:#include <OnAutoItExit_Handler.au3> _OnAutoItExit_AddFunc("MyTestFunc", "Some data") _OnAutoItExit_AddFunc("MyTestFunc2", "Some other data") Sleep(1000) ;_OnAutoItExit_RemoveFunc("MyTestFunc") Func OnAutoItExit() ;If we have our own OnAutoItExit function, OnAutoItExit_Handler will add ("pick up") this function to the handler :) ;It's helpfull when this function is defined by some UDF that we using in our scripts. MsgBox(64, "Exit Results 1", "Exit Message from OnAutoItExit()") EndFunc Func MyTestFunc($sParam) MsgBox(64, "Exit Results 2", 'Exit Message from MyTestFunc("' & $sParam & '")') EndFunc Func MyTestFunc2($sParam) MsgBox(64, "Exit Results 3", 'Exit Message from MyTestFunc("' & $sParam & '")') EndFuncNotes:* This include is usefull for the UDF writters, to let them set OnAutoItExit() function to free some resources, perhaps in the future i should add an option to check constantly the Opt("OnExitFunc") and add to the list if new function was set.* If you are including some UDF that uses OnAutoItExit function, then «OnAutoItExit Handler» UDF will "catch" that function and call it when script is exits.* OnAutoItStart() function can not be handled as OnAutoItExit() function (due to the lack of ability of changing it's name, and also because when it's called there is no variables declared and we can not add other function calls by func), but we still can add a multiple functions from inside OnAutoItStart function, example:Func OnAutoItStart() Local $aOnAutoItStart_Funcs = StringSplit("OnAutoItStart_1|OnAutoItStart_2", "|");Add here as many as you need For $i = 1 To $aOnAutoItStart_Funcs[0] If $aOnAutoItStart_Funcs[$i] = "OnAutoItStart" Then ContinueLoop;Prevent recursion error Call($aOnAutoItStart_Funcs[$i]) Next EndFuncBut it's not so practical (not usefull), since we can't use it to overcome other UDF's defined function (OnAutoItStart()).========================================================Download: OnAutoItExit_Handler.zip Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
FireFox Posted December 30, 2008 Share Posted December 30, 2008 @MrCreator dont know why nobody reply to your udf... (same thing for my AVICapture) But i think its great idea mate Cheers, FireFox. Link to comment Share on other sites More sharing options...
martin Posted December 30, 2008 Share Posted December 30, 2008 Hi, This Include-UDF idea was inspired from Feature Request on Bug Tracking System about a better OnAutoItStart/OnAutoItExit handling. So here it is: Example: #include <OnAutoItExit_Handler.au3> _OnAutoItExit_AddFunc("MyTestFunc", "Some data") _OnAutoItExit_AddFunc("MyTestFunc2", "Some other data") Sleep(1000) ;_OnAutoItExit_RemoveFunc("MyTestFunc") Func OnAutoItExit() ;If we have our own OnAutoItExit function, OnAutoItExit_Handler will add ("pick up") this function to the handler :) ;It's helpfull when this function is defined by some UDF that we using in our scripts. MsgBox(64, "Exit Results 1", "Exit Message from OnAutoItExit()") EndFunc Func MyTestFunc($sParam) MsgBox(64, "Exit Results 2", 'Exit Message from MyTestFunc("' & $sParam & '")') EndFunc Func MyTestFunc2($sParam) MsgBox(64, "Exit Results 3", 'Exit Message from MyTestFunc("' & $sParam & '")') EndFunc Notes: * This include is usefull for the UDF writters, to let them set OnAutoItExit() function to free some resources, perhaps in the future i should add an option to check constantly the Opt("OnExitFunc") and add to the list if new function was set. * If you are including some UDF that uses OnAutoItExit function, then «OnAutoItExit Handler» UDF will "catch" that function and call it when script is exits. * OnAutoItStart() function can not be handled as OnAutoItExit() function (due to the lack of ability of changing it's name, and also because when it's called there is no variables declared and we can not add other function calls by func), but we still can add a multiple functions from inside OnAutoItStart function, example: Func OnAutoItStart() Local $aOnAutoItStart_Funcs = StringSplit("OnAutoItStart_1|OnAutoItStart_2", "|");Add here as many as you need For $i = 1 To $aOnAutoItStart_Funcs[0] If $aOnAutoItStart_Funcs[$i] = "OnAutoItStart" Then ContinueLoop;Prevent recursion error Call($aOnAutoItStart_Funcs[$i]) Next EndFunc But it's not so practical (not usefull), since we can't use it to overcome other UDF's defined function (OnAutoItStart()). ======================================================== Download: OnAutoItExit_Handler.zip Thanks MrCreatoR, a neat solution to an old irritation. If the OnAutoItExit handling gets improved then we will be able to cope with more than 1 udf which has an OnExit function, meanwhile this is good and covers nearly all requirements IMO. Now I would be interestd to see you do the same for udfs which have, or should have, things like WM_COMMAND functions Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
MrCreatoR Posted December 31, 2008 Author Share Posted December 31, 2008 Now I would be interestd to see you do the same for udfs which have, or should have, things like WM_COMMAND functionsI am not sure i follow your thought here ... Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
martin Posted December 31, 2008 Share Posted December 31, 2008 I am not sure i follow your thought here ...It could be because my thoughts are wrong. Some udfs register their own functions for WM_COMMAND. _EIPListView.au3 is one example. If you use this udf and want to register WM_COMMAND for some reason then you have to modify the udf. It would be better if you could register events for controls by having a function which added cases to a global WM_COMMAND handler. Or have I misunderstood something? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
MrCreatoR Posted December 31, 2008 Author Share Posted December 31, 2008 It could be because my thoughts are wrong. Some udfs register their own functions for WM_COMMAND. _EIPListView.au3 is one example. If you use this udf and want to register WM_COMMAND for some reason then you have to modify the udf. It would be better if you could register events for controls by having a function which added cases to a global WM_COMMAND handler. Or have I misunderstood something?I don't think we can do it. There will be a problem because we can't (?) check the current registered WM_* function and set another one to call the old one. If GUIRegisterMsg() was returning the current function name that is registered to specific message, then it would be possible. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now