Sign in to follow this  
Followers 0

while/wend error

12 posts in this topic

#1 ·  Posted

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted

... Then shutdown(15)

ummm ... shutdown AND reboot together? try "shutdown(13)" for shutdown or "shutdown(6)" for reboot instead.

Greetings,

ZeD

Share this post


Link to post
Share on other sites

#3 ·  Posted

Because you did not close the If statements with EndIf

Share this post


Link to post
Share on other sites

#4 ·  Posted

@KnowledgeSponge:

You do not need to close with EndIf if you write in one line.

See help file:

Example

;Terminates script if no command-line arguments

If $CmdLine[0]= 0 Then Exit

;Alternative:

If $CmdLine[0] = 0 Then

    Exit

EndIf

Greetings,

ZeD

Share this post


Link to post
Share on other sites

#5 ·  Posted

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

Share this post


Link to post
Share on other sites

#6 ·  Posted

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.

Share this post


Link to post
Share on other sites

#7 ·  Posted

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}>

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)

Share this post


Link to post
Share on other sites

#8 ·  Posted

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 :ph34r:

thanks!!!

~Todd


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

#9 ·  Posted

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 :ph34r:

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)

Share this post


Link to post
Share on other sites

#10 ·  Posted

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.

Share this post


Link to post
Share on other sites

#11 ·  Posted

different versions maybe?


Roger! You son of a big pile o' Monkey Nuts.

Share this post


Link to post
Share on other sites

#12 ·  Posted

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0