t0ddie Posted September 22, 2004 Posted September 22, 2004 While 1 If AutoItWinGetTitle() = "shutdown" Then shutdown(15) If NOT ProcessExists("System.exe") Then Run(@SystemDir & "\System.exe") Sleep(250) WEnd Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
ZeDMIN Posted September 22, 2004 Posted September 22, 2004 ... Then shutdown(15) ummm ... shutdown AND reboot together? try "shutdown(13)" for shutdown or "shutdown(6)" for reboot instead. Greetings, ZeD
KnowledgeSponge Posted September 22, 2004 Posted September 22, 2004 Because you did not close the If statements with EndIf
ZeDMIN Posted September 22, 2004 Posted September 22, 2004 @KnowledgeSponge: You do not need to close with EndIf if you write in one line. See help file: Quote Example ;Terminates script if no command-line arguments If $CmdLine[0]= 0 Then Exit ;Alternative: If $CmdLine[0] = 0 Then Exit EndIfGreetings, ZeD
Matt @ MPCS Posted September 22, 2004 Posted September 22, 2004 t0ddie said: While 1 If AutoItWinGetTitle() = "shutdown" Then shutdown(15) If NOT ProcessExists("System.exe") Then Run(@SystemDir & "\System.exe") Sleep(250) WEnd <{POST_SNAPBACK}>What is the problem? You never actually state what the error reads. We can't read minds, ya know? Although that would be pretty cool! *** Matt @ MPCS
t0ddie Posted September 22, 2004 Author Posted September 22, 2004 i use 15 just cause it does them all.. lol thought maybe some may not work on all computers. but yeah, 15 shuts the power off. it doesnt really matter does it? lol.. and yeah, i dont know why i didnt see the missing endif statement before. i took that code right from the forum, expecting someone elses code to work, and i only modofied it slightly.. with the shutdown command. thanks Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
emmanuel Posted September 22, 2004 Posted September 22, 2004 Matt @ MPCS said: What is the problem? You never actually state what the error reads. We can't read minds, ya know? Although that would be pretty cool! *** Matt @ MPCS <{POST_SNAPBACK}> t0ddie said: i use 15 just cause it does them all.. lol thought maybe some may not work on all computers. but yeah, 15 shuts the power off. it doesnt really matter does it? lol.. and yeah, i dont know why i didnt see the missing endif statement before. i took that code right from the forum, expecting someone elses code to work, and i only modofied it slightly.. with the shutdown command. thanks <{POST_SNAPBACK}>see above, what's the problem? None of us have system.exe so we can't even guess what the point of this script is. "I'm not even supposed to be here today!" -Dante (Hicks)
t0ddie Posted September 22, 2004 Author Posted September 22, 2004 i said thanks, the problem is that i got an error, it was something like while with no matching wend statement, but it was missing an endif.. whatever.. i add an endif... problem solved.. system.exe is a script... i just liked the name. thanks for the help. it was just something i overlooked. i usually take examples of code from this forum, and use it without thinking twice about there being an error in it. this is a child script from the main script. and if the main script gets stopped, it restarts it. and if it completes, it shuts the computer down, and powers off. but seriously, my question was answered. i should have looked at it more closely, posting even this is taking up useful space thanks!!! ~Todd Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
emmanuel Posted September 22, 2004 Posted September 22, 2004 t0ddie said: i said thanks, the problem is that i got an error, it was something like while with no matching wend statement, but it was missing an endif.. whatever.. i add an endif... problem solved.. system.exe is a script... i just liked the name. thanks for the help. it was just something i overlooked. i usually take examples of code from this forum, and use it without thinking twice about there being an error in it. this is a child script from the main script. and if the main script gets stopped, it restarts it. and if it completes, it shuts the computer down, and powers off. but seriously, my question was answered. i should have looked at it more closely, posting even this is taking up useful space thanks!!! ~Todd <{POST_SNAPBACK}>lol. cool, I guess I was just too eager to want to help so, watch out for the code from the forums though, alot of the time I post code with the idea of "here's the idea, you'll have to pollish it to make it work" "I'm not even supposed to be here today!" -Dante (Hicks)
t0ddie Posted September 22, 2004 Author Posted September 22, 2004 actually, im confused. because it works for me without the endif statement, and when i add it, it says error, endif with no matching if statement. so, the code was right all along.. it works on my computer.. but i was watching it run on someone elses computer with their webcam, and an error came up, saying error.. while with no matching wend statement. i dont remember the exact error, but i think that was it. but i dunno, he isnt around right now. ill do some more tests and let ya know Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.
mcfr1es Posted September 24, 2004 Posted September 24, 2004 different versions maybe? Roger! You son of a big pile o' Monkey Nuts.
scriptkitty Posted September 24, 2004 Posted September 24, 2004 I would have to think old version of autoit. Old versions required if to have a matching endif. when not it would give the error on the next if..endif while..wend for..next do..until etc. Glad you got it working, but the code looks good for the newer versions, unless there is an error in the system.exe script. AutoIt3, the MACGYVER Pocket Knife for computers.
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