oToom Posted May 28, 2008 Posted May 28, 2008 #include <GUIConstants.au3> Guicreate("[SA]", 169, 92) $Start = GUICtrlCreateButton("Start", 10, 10, 150, 30) $Stop = GUICtrlCreateButton("Stop", 10, 50, 150, 30) Global $hWNd = WinGetTitle("Windows Live Messenger") GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Select Case $Msg = $Start while 1 If $hWnd Then WinClose($hWnd) Else Sleep(30000) EndIf WEnd Case $Msg = $Stop GUIDelete() Exit EndSelect WEnd Well that is my script so far. What i am tring to do is, my sister broke her laptop, and is bugging me none stop to use msn on my computer. What i want to do is click the start button, and it will constantly check until the window, Windows Live Messenger is found, then close msn. Is this the correct way of going about it? Cheers guys.
HaavY Posted May 28, 2008 Posted May 28, 2008 #include <GUIConstants.au3> Guicreate("[SA]", 169, 92) $Start = GUICtrlCreateButton("Start", 10, 10, 150, 30) $Stop = GUICtrlCreateButton("Stop", 10, 50, 150, 30) Global $hWNd = WinGetTitle("Windows Live Messenger") GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Select Case $Msg = $Start while 1 If $hWnd Then WinClose($hWnd) Else Sleep(30000) EndIf WEnd Case $Msg = $Stop GUIDelete() Exit EndSelect WEnd Well that is my script so far. What i am tring to do is, my sister broke her laptop, and is bugging me none stop to use msn on my computer. What i want to do is click the start button, and it will constantly check until the window, Windows Live Messenger is found, then close msn. Is this the correct way of going about it? Cheers guys. You are evil to your sister... just like me I think this will do it: #include <GUIConstants.au3> Guicreate("[SA]", 169, 92) $Start = GUICtrlCreateButton("Start", 10, 10, 150, 30) $Stop = GUICtrlCreateButton("Stop", 10, 50, 150, 30) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Select Case $Msg = $Start while 1 WinWaitActive("Windows Live Messenger") WinClose("Windows Live Messenger") Else Sleep(30000) EndIf WEnd Case $Msg = $Stop GUIDelete() Exit EndSelect WEnd Have not tested it though. [font="Courier New"]This sentence is a lie. Or is it?[/font]Better leave AutoIt then
sandin Posted May 28, 2008 Posted May 28, 2008 expandcollapse popup#include <GUIConstants.au3> Global $loop = True Guicreate("[SA]", 169, 92) $Start = GUICtrlCreateButton("Start", 10, 10, 150, 30) $exit = GUICtrlCreateButton("Exit", 10, 50, 150, 30) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Select Case $Msg = $Start _checkForMsn() Case $Msg = $exit Exit case $Msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd func _checkForMsn() GUICtrlSetData($Start, "Stop") While 1 $Msg = GUIGetMsg() Select Case $Msg = $Start GUICtrlSetData($Start, "Start") ExitLoop Case $Msg = $exit Exit case $Msg = $GUI_EVENT_CLOSE Exit EndSelect $hWNd = WinGetTitle("Windows Live Messenger") if $hWnd then WinClose($hWnd) ;~ ExitLoop EndIf WEnd EndFunc Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll
oToom Posted May 28, 2008 Author Posted May 28, 2008 (edited) Haavy, thank you, Works perfects. sandin, also works fine. Yet Haavy's is alot easier so i will go for his. Thank you both! EDIT: I got rid of the GUI so she cannot see it =p Edited May 28, 2008 by oToom
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