lokeycmos Posted January 26, 2009 Share Posted January 26, 2009 im trying to write a script to close peer guardian 2 with out involving the mouse. i am able to end the process, but it has 'side effects'. when i end the process rather than 'properly exiting' the program, it gives an error msg(see pic). ideally i would rather find a way to 'properly exit' than having to deal with the PG2 Fix utility that is needed to fix the error msg. i tried modifying the code from this post: http://www.autoitscript.com/forum/index.php?showtopic=86316 but not having much luck. any help is greatly appreciated! -Joe Link to comment Share on other sites More sharing options...
Zedna Posted January 26, 2009 Share Posted January 26, 2009 Try to use WinClose() instead of ProcessClose() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
lokeycmos Posted January 26, 2009 Author Share Posted January 26, 2009 the problem with that is that when closed, it minimizes to the tray. Link to comment Share on other sites More sharing options...
Zedna Posted January 26, 2009 Share Posted January 26, 2009 the problem with that is that when closed, it minimizes to the tray.If that tray icon has popup menu with "close" option then invoke this menu item. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
lokeycmos Posted January 26, 2009 Author Share Posted January 26, 2009 is there a 'right click' command in autoit? if so, the icon may be in different locations in the tray at any given time. i appreciate your quick replies, thank you. im leaving for work now Link to comment Share on other sites More sharing options...
Zedna Posted January 26, 2009 Share Posted January 26, 2009 is there a 'right click' command in autoit? if so, the icon may be in different locations in the tray at any given time. i appreciate your quick replies, thank you. im leaving for work nowSearch forum for some clever keywords maybe something like: +tray +popup Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Inverted Posted January 26, 2009 Share Posted January 26, 2009 I wonder if two consecutive WinClose would do the job. Worth a quick try. Link to comment Share on other sites More sharing options...
Thamiel Posted January 26, 2009 Share Posted January 26, 2009 (edited) Try the following if PG2 is already running in the systray( if not start it first ;-) ), it'll uncheck the 'Hide window on close' checkbox , then close it correctly next it'll restart PG2 and reset the check box back to normal (works if PG2 has been installed into it's default install directory) CODE ControlCommand("PeerGuardian 2", "", 1172, "UnCheck", "") WinClose("PeerGuardian 2", "") Sleep(1000) Run(@ProgramFilesDir&"\PeerGuardian2\pg2.exe") WinWaitActive("PeerGuardian 2","") ControlCommand("PeerGuardian 2", "", 1172, "Check", "") WinClose("PeerGuardian 2", "") Edited January 27, 2009 by Thamiel Link to comment Share on other sites More sharing options...
lokeycmos Posted January 27, 2009 Author Share Posted January 27, 2009 Try the following if PG2 is already running in the systray( if not start it first ;-) ), it'll uncheck the 'Hide window on close' checkbox , then close it correctly next it'll restart PG2 and reset the check box back to normal(works if PG2 has been installed into it's default install directory)CODEControlCommand("PeerGuardian 2", "", 1172, "UnCheck", "")WinClose("PeerGuardian 2", "")Sleep(1000)Run(@ProgramFilesDir&"\PeerGuardian2\pg2.exe")WinWaitActive("PeerGuardian 2","")ControlCommand("PeerGuardian 2", "", 1172, "Check", "")WinClose("PeerGuardian 2", "")SWEET! Thanx Thamiel! Ur code works flawlessy and its short n sweet. 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