sevad Posted November 13, 2006 Share Posted November 13, 2006 (edited) Hi, I'm relatively new to AutoIt and was writing some simple code to help me get the hang of it. When I started using simple loops I noticed that they weren't working. Can someone tell me what the problem is? dim $value $value = 1 run ("notepad.exe") winwaitactive("Untitled - Notepad") do If WinExists("Untitled -") Then send("how are you") sleep(200) EndIf while $value = 1 I know that this would be an infinite loop at this point if the loop were functioning correctly, but it only runs once, then shuts itself off. Any ideas anyone? Edited November 13, 2006 by sevad Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 13, 2006 Moderators Share Posted November 13, 2006 Do / Until While / WEnd For / Next 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...
Thatsgreat2345 Posted November 13, 2006 Share Posted November 13, 2006 (edited) its do until not , do while Example Global $value = 1 run ("notepad.exe") WinWaitActive("Untitled - Notepad") Do If WinExists("Untitled - Notepad") Then While WinActive("Untitled - Notepad") send("how are you") sleep(200) WEnd $value += 1 ; adds 1 to value which exits the loop EndIf Until $value <> 1 oÝ÷ ÚØb³¥ìb·^*.rZ,zØ^^¥§pwhÁ«¢+Ø)±½°ÀÌØíÙ±ÕôÄ)ÉÕ¸ ÅÕ½Ðí¹½ÑÁ¹áÅÕ½Ðì¤)]¥¹]¥ÑÑ¥Ù ÅÕ½ÐíU¹Ñ¥Ñ±´9½ÑÁÅÕ½Ðì¤()]¡¥±]¥¹á¥ÍÑÌ ÅÕ½ÐíU¹Ñ¥Ñ±´9½ÑÁÅÕ½Ðì¤)]¡¥±]¥¹Ñ¥Ù ÅÕ½ÐíU¹Ñ¥Ñ±´9½ÑÁÅÕ½Ðì¤(͹ ÅÕ½Ðí¡½ÜÉå½ÔÅÕ½Ðì¤(ͱÀ ÈÀÀ¤)]¹)]¹( Edited November 14, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
sevad Posted November 13, 2006 Author Share Posted November 13, 2006 Thank you so much smoke_n and thatsgreat! Sorry about the stupid mistake. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 13, 2006 Moderators Share Posted November 13, 2006 its do until not , do while Example Global $value = 1 run ("notepad.exe") WinWaitActive("Untitled - Notepad") Do If WinExists("Untitled - Notepad") Then While WinActive("Untitled - Notepad") send("how are you") sleep(200) $value += 1 ; adds 1 to value which exits the loop EndIf Until $value <> 1 oÝ÷ ÚØb³¥ìb·^*.rZ,zØ^^¥§pwhÁ«¢+Ø)±½°ÀÌØíÙ±ÕôÄ)ÉÕ¸ ÅÕ½Ðí¹½ÑÁ¹áÅÕ½Ðì¤)]¥¹]¥ÑÑ¥Ù ÅÕ½ÐíU¹Ñ¥Ñ±´9½ÑÁÅÕ½Ðì¤()]¡¥±]¥¹á¥ÍÑÌ ÅÕ½ÐíU¹Ñ¥Ñ±´9½ÑÁÅÕ½Ðì¤)]¡¥±]¥¹Ñ¥Ù ÅÕ½ÐíU¹Ñ¥Ñ±´9½ÑÁÅÕ½Ðì¤(͹ ÅÕ½Ðí¡½ÜÉå½ÔÅÕ½Ðì¤(ͱÀ ÈÀÀ¤)]¹)]¹(Might want to check that first example you provided... think your missing something 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...
realkiller Posted November 13, 2006 Share Posted November 13, 2006 run ("notepad.exe") WinWaitActive("Untitled - Notepad") If WinExists("Untitled - Notepad") Then Send("how are you") EndIf this useses less peformance and quicker Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 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