Infinitex0 Posted February 5, 2006 Share Posted February 5, 2006 (Hi) I trying to make a scipt that is present at startup and closes a certain file whenever it is activated WinWait( "X") If WinActive("X") Then WinKill( "X") Sleep(3000) EndIf whenever I run it, I open x and the autoit icon disappears, but x is still open. PLEASE don't give me a new code, just tell me what I am doing wrong The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center] Link to comment Share on other sites More sharing options...
greenmachine Posted February 5, 2006 Share Posted February 5, 2006 Three things: 1. Are you sure "X" is active when it starts up? If not, the winkill won't work. 2. According to the helpfile, some windows, notably explorer windows, cannot be killed. If your window is one of these special ones, you might want to try WinClose instead. 3. To guarantee that "X" is active when you need it to be, I would use WinWaitActive instead. Link to comment Share on other sites More sharing options...
DeFuser Posted February 5, 2006 Share Posted February 5, 2006 The following works for me (when opening the file "test.txt" in Notepad: While 1 If WinExists ( "test.txt - Notepad", "" ) Then Sleep(200) WinKill( "test.txt - Notepad", "" ) EndIf WEnd Try using WinExists and a While-WEnd loop. Cheers, Def Link to comment Share on other sites More sharing options...
Infinitex0 Posted February 5, 2006 Author Share Posted February 5, 2006 (edited) Thanks greenmachine and DeFuser. Edited February 5, 2006 by Infinitex0 The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center] Link to comment Share on other sites More sharing options...
DeFuser Posted February 5, 2006 Share Posted February 5, 2006 I'm glad to assist. More than you know actually, because this is the first time I've actually been able to contribute (as opposed to ask questions). Cheers,Def Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 5, 2006 Moderators Share Posted February 5, 2006 I'm glad to assist. More than you know actually, because this is the first time I've actually been able to contribute (as opposed to ask questions). Cheers,DefYou only joined 2 days ago DeFuser... You'll contribute much more soon, I'm sure!! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
DeFuser Posted February 5, 2006 Share Posted February 5, 2006 You only joined 2 days ago DeFuser... You'll contribute much more soon, I'm sure!! Ahhh, thanks for the encouragement! I figure that while true proficiency is still a (long) way off, at least the code snippets I stumple across are beginning to look less gibberishish ... and that's a definite good sign! Link to comment Share on other sites More sharing options...
w0uter Posted February 5, 2006 Share Posted February 5, 2006 (edited) i would go for like: While WinExists ('X') WinKill('X') Sleep(100) WEnd Edited February 5, 2006 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll 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