Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

while/wend error


  • Please log in to reply
11 replies to this topic

#1 t0ddie

t0ddie

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 977 posts

Posted 22 September 2004 - 06:48 AM

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.







#2 ZeDMIN

ZeDMIN

    Wayfarer

  • Active Members
  • Pip
  • 97 posts

Posted 22 September 2004 - 07:26 AM

... Then shutdown(15)


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


Greetings,
ZeD

#3 KnowledgeSponge

KnowledgeSponge

    Wayfarer

  • Active Members
  • Pip
  • 63 posts

Posted 22 September 2004 - 08:09 AM

Because you did not close the If statements with EndIf

#4 ZeDMIN

ZeDMIN

    Wayfarer

  • Active Members
  • Pip
  • 97 posts

Posted 22 September 2004 - 09:17 AM

@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

#5 Matt @ MPCS

Matt @ MPCS

    Just another AutoIt user trying to help out! :)

  • Active Members
  • PipPipPipPipPipPip
  • 700 posts

Posted 22 September 2004 - 02:34 PM

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

#6 t0ddie

t0ddie

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 977 posts

Posted 22 September 2004 - 03:59 PM

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.

#7 emmanuel

emmanuel

    No one ever accused me of being normal.

  • Active Members
  • PipPipPipPipPipPip
  • 1,128 posts

Posted 22 September 2004 - 04:04 PM

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)

#8 t0ddie

t0ddie

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 977 posts

Posted 22 September 2004 - 04:23 PM

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.

#9 emmanuel

emmanuel

    No one ever accused me of being normal.

  • Active Members
  • PipPipPipPipPipPip
  • 1,128 posts

Posted 22 September 2004 - 04:45 PM

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)

#10 t0ddie

t0ddie

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 977 posts

Posted 22 September 2004 - 06:04 PM

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.

#11 mcfr1es

mcfr1es

    Wayfarer

  • Active Members
  • Pip
  • 58 posts

Posted 24 September 2004 - 07:48 PM

different versions maybe?
Roger! You son of a big pile o' Monkey Nuts.

#12 scriptkitty

scriptkitty

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,274 posts

Posted 24 September 2004 - 08:12 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users