mathew Posted August 5, 2009 Share Posted August 5, 2009 Hey, I searched in the forum for an answer, but I failed. I wrote a script which should login into a website and notify me if there is a change. To make changes on the running program I wanted to control it with the help of the trayicon and it's buttons. The script works fine and do his job, also the changes work. But sometimes my program freeze until I go over the trayicon with the mouse cursor. Just go over it, no clicking, just go over it and it continues its work. I can not explain why it freeze. Maybe someone can help me out of it. I use WinXP with newest updates and AutoIt v3.3.0.0. expandcollapse popup#include <IE.au3> Opt("CaretCoordMode", 1) ;1=absolute, 0=relative, 2=client Opt("ExpandEnvStrings", 0) ;0=don't expand, 1=do expand Opt("ExpandVarStrings", 0) ;0=don't expand, 1=do expand Opt("FtpBinaryMode", 1) ;1=binary, 0=ASCII Opt("GUICloseOnESC", 1) ;1=ESC closes, 0=ESC won't close Opt("GUICoordMode", 1) ;1=absolute, 0=relative, 2=cell Opt("GUIDataSeparatorChar","|") ;"|" is the default Opt("GUIOnEventMode", 0) ;0=disabled, 1=OnEvent mode enabled Opt("GUIResizeMode", 0) ;0=no resizing, <1024 special resizing Opt("GUIEventOptions",0) ;0=default, 1=just notification, 2=GuiCtrlRead tab index Opt("MouseClickDelay", 10) ;10 milliseconds Opt("MouseClickDownDelay", 10) ;10 milliseconds Opt("MouseClickDragDelay", 250) ;250 milliseconds Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client Opt("MustDeclareVars", 0) ;0=no, 1=require pre-declare Opt("OnExitFunc","OnAutoItExit");"OnAutoItExit" called Opt("PixelCoordMode", 1) ;1=absolute, 0=relative, 2=client Opt("SendAttachMode", 0) ;0=don't attach, 1=do attach Opt("SendCapslockMode", 1) ;1=store and restore, 0=don't Opt("SendKeyDelay", 5) ;5 milliseconds Opt("SendKeyDownDelay", 1) ;1 millisecond Opt("TCPTimeout",100) ;100 milliseconds Opt("TrayAutoPause",0) ;0=no pause, 1=Pause Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info Opt("TrayIconHide", 0) ;0=show, 1=hide tray icon Opt("TrayMenuMode",1) ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID not return Opt("TrayOnEventMode",0) ;0=disable, 1=enable Opt("WinDetectHiddenText", 0) ;0=don't detect, 1=do detect Opt("WinSearchChildren", 1) ;0=no, 1=search children also Opt("WinTextMatchMode", 1) ;1=complete, 2=quick Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Opt("WinWaitDelay", 250) ;250 milliseconds #requireadmin ; just for WinVista ; ##### Menu ##### $item_settings = TrayCreateMenu("Settings") $item_setting_notify = TrayCreateItem("Notification: On",$item_settings) $item_setting_changeuser= TrayCreateItem("Change Username",$item_settings) $item_setting_changepw = TrayCreateItem("Change Passwort",$item_settings) TrayCreateItem("",$item_settings) $item_setting_save = TrayCreateItem("Save Settings",$item_settings) $item_startstopbot = TrayCreateItem("Start") $item_waitingbot = TrayCreateItem("Waittime") TrayCreateItem("") $item_about = TrayCreateItem("About") TrayCreateItem("") $item_exit = TrayCreateItem("Exit") TraySetState() [... here are some variables declared ...] While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $item_setting_notify func_changenotify() [... and all other functions ...] Case $msg = $item_exit ExitLoop EndSelect [ ... functions to check the website, last about 200msec ... ] ; this function here opens the website and checks the infomation ; and close the window when hes done his job ; but i debugged the function and it always last about 200ms ; not longer, so that it could freeze the programm WEnd Exit [ ... my own functions ... ] Thanks for answers, Best regards Matthias Weidmann Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 5, 2009 Share Posted August 5, 2009 Hey, I searched in the forum for an answer, but I failed. I wrote a script which should login into a website and notify me if there is a change. To make changes on the running program I wanted to control it with the help of the trayicon and it's buttons. The script works fine and do his job, also the changes work. But sometimes my program freeze until I go over the trayicon with the mouse cursor. Just go over it, no clicking, just go over it and it continues its work. I can not explain why it freeze. Maybe someone can help me out of it. I use WinXP with newest updates and AutoIt v3.3.0.0. expandcollapse popup#include <IE.au3> Opt("CaretCoordMode", 1) ;1=absolute, 0=relative, 2=client Opt("ExpandEnvStrings", 0) ;0=don't expand, 1=do expand Opt("ExpandVarStrings", 0) ;0=don't expand, 1=do expand Opt("FtpBinaryMode", 1) ;1=binary, 0=ASCII Opt("GUICloseOnESC", 1) ;1=ESC closes, 0=ESC won't close Opt("GUICoordMode", 1) ;1=absolute, 0=relative, 2=cell Opt("GUIDataSeparatorChar","|") ;"|" is the default Opt("GUIOnEventMode", 0) ;0=disabled, 1=OnEvent mode enabled Opt("GUIResizeMode", 0) ;0=no resizing, <1024 special resizing Opt("GUIEventOptions",0) ;0=default, 1=just notification, 2=GuiCtrlRead tab index Opt("MouseClickDelay", 10) ;10 milliseconds Opt("MouseClickDownDelay", 10) ;10 milliseconds Opt("MouseClickDragDelay", 250) ;250 milliseconds Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client Opt("MustDeclareVars", 0) ;0=no, 1=require pre-declare Opt("OnExitFunc","OnAutoItExit");"OnAutoItExit" called Opt("PixelCoordMode", 1) ;1=absolute, 0=relative, 2=client Opt("SendAttachMode", 0) ;0=don't attach, 1=do attach Opt("SendCapslockMode", 1) ;1=store and restore, 0=don't Opt("SendKeyDelay", 5) ;5 milliseconds Opt("SendKeyDownDelay", 1) ;1 millisecond Opt("TCPTimeout",100) ;100 milliseconds Opt("TrayAutoPause",0) ;0=no pause, 1=Pause Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info Opt("TrayIconHide", 0) ;0=show, 1=hide tray icon Opt("TrayMenuMode",1) ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID not return Opt("TrayOnEventMode",0) ;0=disable, 1=enable Opt("WinDetectHiddenText", 0) ;0=don't detect, 1=do detect Opt("WinSearchChildren", 1) ;0=no, 1=search children also Opt("WinTextMatchMode", 1) ;1=complete, 2=quick Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Opt("WinWaitDelay", 250) ;250 milliseconds #requireadmin ; just for WinVista ; ##### Menu ##### $item_settings = TrayCreateMenu("Settings") $item_setting_notify = TrayCreateItem("Notification: On",$item_settings) $item_setting_changeuser= TrayCreateItem("Change Username",$item_settings) $item_setting_changepw = TrayCreateItem("Change Passwort",$item_settings) TrayCreateItem("",$item_settings) $item_setting_save = TrayCreateItem("Save Settings",$item_settings) $item_startstopbot = TrayCreateItem("Start") $item_waitingbot = TrayCreateItem("Waittime") TrayCreateItem("") $item_about = TrayCreateItem("About") TrayCreateItem("") $item_exit = TrayCreateItem("Exit") TraySetState() [... here are some variables declared ...] While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $item_setting_notify func_changenotify() [... and all other functions ...] Case $msg = $item_exit ExitLoop EndSelect [ ... functions to check the website, last about 200msec ... ] ; this function here opens the website and checks the infomation ; and close the window when hes done his job ; but i debugged the function and it always last about 200ms ; not longer, so that it could freeze the programm WEnd Exit [ ... my own functions ... ] Thanks for answers, Best regards Matthias Weidmann What's with the huge list of options, most of which are just set to default values? At any rate try taking out the TrayIconDebug mode you set. Maybe that's conflicting. >_< Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
mathew Posted August 7, 2009 Author Share Posted August 7, 2009 I removed the default options from the script and set the TrayIconDebug mode off. But the problem is still there. I found out at which point the program freeze, but I can not explain why. I open a window to check the content, but it takes some time to open it and needs to be open for a while. So I initialised a timer and check whether the 30 sec are gone and then the program should get the content and close the window. but this check whether the timer reached 30 sec fail until I went over the icon. Someone has a solution for this problem? I hope its understandable what I've wrote. Thanks for answers. Best Regards Matthias Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 7, 2009 Share Posted August 7, 2009 I removed the default options from the script and set the TrayIconDebug mode off.But the problem is still there. I found out at which point the program freeze,but I can not explain why.I open a window to check the content, but ittakes some time to open it and needs to be openfor a while. So I initialised a timer and checkwhether the 30 sec are gone and then the programshould get the content and close the window.but this check whether the timer reached 30 secfail until I went over the icon. Someone has asolution for this problem?I hope its understandable what I've wrote.Thanks for answers. Best RegardsMatthiasI'm not getting it. There's no timer in the code you posted, and it can't be run anyway. Try posting a reproducer script that we can run to duplicate the symptoms. >_< Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
mathew Posted August 9, 2009 Author Share Posted August 9, 2009 So here I have a little program that shows my problem with TrayGetMsg. I thought it will add 1 to whiletest all the time, but it only adds 1 if you move above the tray icon. So the program seems to freeze when I want to start functions in the whileloop. How can I solve this problem? I want whiletest to be added 1 all the time and have access to the tray menu at the same time. Best regards, Matthias $item_about = TrayCreateItem("About") TrayCreateItem("") $item_exit = TrayCreateItem("Exit") TraySetState() $whiletest = 0 While 1 func_notification() $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $item_about MsgBox(0,"About","Abouttext") Case $msg = $item_exit ExitLoop EndSelect $whiletest = $whiletest +1 Sleep(100) WEnd Exit Func func_notification() ToolTip($whiletest,0,0,"Durations",1) EndFunc Link to comment Share on other sites More sharing options...
Bowmore Posted August 9, 2009 Share Posted August 9, 2009 This will do what you want. I've moved $whiletest = $whiletest +1 to where it will get updated even if $msg is 0 $item_about = TrayCreateItem("About") TrayCreateItem("") $item_exit = TrayCreateItem("Exit") TraySetState() $whiletest = 0 While 1 func_notification() $msg = TrayGetMsg() $whiletest = $whiletest +1 Select Case $msg = 0 ContinueLoop Case $msg = $item_about MsgBox(0,"About","Abouttext") Case $msg = $item_exit ExitLoop EndSelect Sleep(100) WEnd Exit Func func_notification() ToolTip($whiletest,0,0,"Durations",1) EndFunc "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
mathew Posted August 10, 2009 Author Share Posted August 10, 2009 Oh no, I've just forgotten the ContinueLoop. Thanks for your help! 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