muzle6074 Posted July 14, 2008 Share Posted July 14, 2008 Hi every1, I was wondering how I could have the tray icon pop up a little message if $handle is minimized? Regards. Func status() $win_state = WinGetState($handle) If BitAND($win_state, 16) Then ; tray icon message EndIf EndFunc Link to comment Share on other sites More sharing options...
Jeemo Posted July 14, 2008 Share Posted July 14, 2008 (edited) Check out TrayTip() in the help file. The only reason why the tray balloon wouldn't work is if you disable the tray icon for your script or if the user killed all balloon tips via the registry.Edit: fixed typo Edited July 14, 2008 by Jeemo An emoticon is worth a dozen words. Link to comment Share on other sites More sharing options...
muzle6074 Posted July 15, 2008 Author Share Posted July 15, 2008 (edited) Thanks for the info Jeemo, I tried this code but it didn't work, any help? EDIT: I forgot to add that I'm using AdlibEnable("script_state"). Func script_state() $win_state = WinGetState($handle) If BitAND($win_state, 16) Then TrayTip(@ScriptName, $status, 10) EndIf EndFunc Edited July 15, 2008 by muzle6074 Link to comment Share on other sites More sharing options...
Jeemo Posted July 15, 2008 Share Posted July 15, 2008 I'm not certain, but I think that the problem is that your TrayTip() call is within a function that runs at the mercy of Adlib (I've never used Adlib, hence my uncertainty). From what I read about it, it should only call your script_state function when an "unhandled" error occurs - minimizing a window would not be considered an error.Your original post looks like it was spot on except for missing the call to TrayTip(). Try something like this:$handle = WinGetHandle("My Target Window") Func status() $win_state = WinGetState($handle) If BitAND($win_state, 16) Then TrayTip(@ScriptName, $status, 10) EndIf EndFunc While 1 status() WEndThe call to status() should be within a tight loop so that it'll respond as soon as the window becomes minimized.If your Tray Tip doesn't pop up, then try swapping it out with something that you know will work, like msgbox, and see if that's responsive.I hope this helps. I apologize if it doesn't, it's pretty late for me and I'm a bit foggy. I'll look for your reply in the morning.Jeemo An emoticon is worth a dozen words. Link to comment Share on other sites More sharing options...
muzle6074 Posted July 15, 2008 Author Share Posted July 15, 2008 Thanks again for your input Jeemo, But unfortunately after changing a few things around the script still wouldn't pop up a message when i minimized the window. To my understanding using AdlibEnable will always check every 250ms (by default) a function so my script_state function should always be checked no matter what is happening. Here's the full script, maybe it will help. Regards. expandcollapse popupHotKeySet("^{HOME}", "start") HotKeySet("^{END}", "finish") AutoItSetOption("WinTitleMatchMode", 4) AutoItSetOption("TrayIconHide", 1) Global $handle = WinGetHandle("classname=GxWindowClassD3d") Global $status = "idle" If @error Then MsgBox(16, "Error", "win not found") Exit EndIf AdlibEnable("script_state") While 1 Sleep(100) WEnd Func start() $status = "running" While 1 $unique = Random(1, 4, 1) If $unique = 1 Then ControlSend($handle, "", "", "{RIGHT DOWN}") Sleep(100 + Random(1, 50, 1)) ControlSend($handle, "", "", "{RIGHT UP}") ControlSend($handle, "", "", "{LEFT DOWN}") Sleep(100 + Random(1, 50, 1)) ControlSend($handle, "", "", "{LEFT UP}") Sleep(200000 + Random(5000, 15000, 1)) ElseIf $unique = 2 Then ControlSend($handle, "", "", "{LEFT DOWN}") Sleep(100 + Random(1, 50, 1)) ControlSend($handle, "", "", "{LEFT UP}") ControlSend($handle, "", "", "{RIGHT DOWN}") Sleep(100 + Random(1, 50, 1)) ControlSend($handle, "", "", "{RIGHT UP}") Sleep(200000 + Random(5000, 15000, 1)) EndIf WEnd EndFunc Func script_state() $win_state = WinGetState($handle) If BitAND($win_state, 16) Then TrayTip(@ScriptName, $status, 10) EndIf EndFunc Func finish() Exit EndFunc Link to comment Share on other sites More sharing options...
Jeemo Posted July 15, 2008 Share Posted July 15, 2008 Ahhhh, I found the problem. Try this: expandcollapse popupHotKeySet("^{HOME}", "start") HotKeySet("^{END}", "finish") AutoItSetOption("WinTitleMatchMode", 4) ;AutoItSetOption("TrayIconHide", 1) Global $handle = WinGetHandle("classname=GxWindowClassD3d") Global $status = "idle" If @error Then MsgBox(16, "Error", "win not found") Exit EndIf AdlibEnable("script_state") While 1 Sleep(100) WEnd Func start() $status = "running" While 1 $unique = Random(1, 4, 1) If $unique = 1 Then ControlSend($handle, "", "", "{RIGHT DOWN}") Sleep(100 + Random(1, 50, 1)) ControlSend($handle, "", "", "{RIGHT UP}") ControlSend($handle, "", "", "{LEFT DOWN}") Sleep(100 + Random(1, 50, 1)) ControlSend($handle, "", "", "{LEFT UP}") Sleep(200000 + Random(5000, 15000, 1)) ElseIf $unique = 2 Then ControlSend($handle, "", "", "{LEFT DOWN}") Sleep(100 + Random(1, 50, 1)) ControlSend($handle, "", "", "{LEFT UP}") ControlSend($handle, "", "", "{RIGHT DOWN}") Sleep(100 + Random(1, 50, 1)) ControlSend($handle, "", "", "{RIGHT UP}") Sleep(200000 + Random(5000, 15000, 1)) EndIf WEnd EndFunc Func script_state() $win_state = WinGetState($handle) If BitAND($win_state, 16) Then TrayTip(@ScriptName, $status, 10) EndIf EndFunc Func finish() Exit EndFunc The only difference between the above code block and what you posted is that line 4 has bee commented out... The only reason why the tray balloon wouldn't work is if you disable the tray icon for your script...muttley An emoticon is worth a dozen words. Link to comment Share on other sites More sharing options...
muzle6074 Posted July 15, 2008 Author Share Posted July 15, 2008 Thank you Jeemo! muttley 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