Jump to content

Help with basic script


Recommended Posts

Heres the basic code:

Do

$a = "C:\Inetpub\wwwroot\_private\miles.txt"

if FileExists($a) Then

$file= FileOpen($a,0)

$temp = filereadline($file)

$name = filereadline($file)

$model = filereadline($file)

$arrive = filereadline($file)

$depart = filereadline($file)

$expense = filereadline($file)

$start = filereadline($file)

$end = filereadline($file)

$comment = filereadline($file)

$date = @MON &"/" & @MDAY &"/" & @YEAR

;$time = @HOUR & ":" & @MIN

;$mess = $name & " " & $date & " " & $time & @LF

FileClose($file)

FileDelete($a)

$a = "C:\Inetpub\wwwroot\mitch\mileage.txt"

$file= FileOpen($a,1)

FileWriteLine($file,$date)

FileWriteLine($file,$name)

FileWriteLine($file,$model)

FileWriteLine($file,$arrive)

FileWriteLine($file,$depart)

FileWriteLine($file,$expense)

FileWriteLine($file,$start)

FileWriteLine($file,$end)

FileWriteLine($file,$comment)

FileWriteLine($file,"***")

FileClose($file)

Until $d = "HELPMESTOPTHISCRAzything12344321"

it gives me an error "C:\Inetpub\wwwroot\form\miles.au3 (32) : ==> "Until" statement with no matching "Do" statement.:

Until $d = "HELPMESTOPTHISCRAzything12344321" "

I clearly have a "do" and "Until" in this?

I also tried this exact same thing using "while" and wend and got the equivalent error.

can anyone explain what I'm doing wrong?

at first I thought that maybe there were too many commands between the do...until but I recently wrote a much longer wrong with the same version of autoit and scite and it compiles an runs just fine.. s I am at a lost..

Link to comment
Share on other sites

missing endif

Do
   $a = "C:\Inetpub\wwwroot\_private\miles.txt"
   If FileExists($a) Then
      $file = FileOpen($a, 0)
      $temp = FileReadLine($file)
      $name = FileReadLine($file)
      $model = FileReadLine($file)
      $arrive = FileReadLine($file)
      $depart = FileReadLine($file)
      $expense = FileReadLine($file)
      $start = FileReadLine($file)
      $end = FileReadLine($file)
      $comment = FileReadLine($file)
      $date = @MON & "/" & @MDAY & "/" & @YEAR
     ;$time = @HOUR & ":" & @MIN
     ;$mess = $name & " " & $date & " " & $time & @LF
      FileClose($file)
      FileDelete($a)
      $a = "C:\Inetpub\wwwroot\mitch\mileage.txt"
      $file = FileOpen($a, 1)
      FileWriteLine($file, $date)
      FileWriteLine($file, $name)
      FileWriteLine($file, $model)
      FileWriteLine($file, $arrive)
      FileWriteLine($file, $depart)
      FileWriteLine($file, $expense)
      FileWriteLine($file, $start)
      FileWriteLine($file, $end)
      FileWriteLine($file, $comment)
      FileWriteLine($file, "***")
      FileClose($file)
   EndIf
Until $d = "HELPMESTOPTHISCRAzything12344321"

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

heres a script that works using the same style code:

#include <GUIConstants.au3>

SplashTextOn("Last Attempted add User", "NONE", -1, 50, -1, -1, 18, "", 24)

Sleep(3000)

$a = "C:\Inetpub\wwwroot\_private\create.txt"

$d=""

$b = 0

Do

$b = $b + 1

$a = "C:\Inetpub\wwwroot\_private\create.txt"

sleep(1000)

$y = 0

if FileExists($a) Then

$file= FileOpen($a,0)

$temp = filereadline($file)

$name = filereadline($file)

$password = filereadline($file)

$secret = filereadline($file)

$date = @MON &"/" & @MDAY &"/" & @YEAR

$time = @HOUR & ":" & @MIN

$mess = $name & " " & $date & " " & $time & @LF

;ControlSetText("Title", "", "Static1", $mess)

SplashTextOn("Last Attempted add User", $mess, -1, 25, -1, -1, 18, "")

FileClose($file)

FileDelete($a)

if $secret = "#hidden#" Then

$file = FileOpen("c:\addedusers.dat",1)

FileWriteLine($file,$name)

FileWriteLine($file, $date)

FileWriteLine($file, $time)

FileClose($file)

$a = "net user " & $name & " " & $password & " /add"

Run($a)

EndIf

if $secret <> "cpdos=22" Then

$file = FileOpen("c:\addedusers.dat",1)

FileWriteLine($file,"USER NOT ADDED SECRET WORD WRONG" & $secret)

FileWriteLine($file,$name)

FileWriteLine($file, $date)

FileWriteLine($file, $time)

FileClose($file)

EndIf

endif

Until $d = "HELPMESTOPTHISCRAzything12344321"

this script compile and runs fine. however if I paste the contents of my other script inbetween (see orig post) the do... until statement i get the same error. so I concluded that it must be something in my code between the two, but if you can't ttell I basically copied one source to the other.... and modified for purposed.

this scrip also works with a while..wend statement

BTW if there is a better or more efficient way to do this please let me know.

Link to comment
Share on other sites

  • Developers

Don't know how your script looks in the editor you use, but if you properly indent your code you would see that an EndIF is missing.

Took your OP code and ran it through Tidy and below the output... does that make sense ? :lmao:

Do
    $a = "C:\Inetpub\wwwroot\_private\miles.txt"
    If FileExists($a) Then
        $file = FileOpen($a, 0)
        $temp = FileReadLine($file)
        $name = FileReadLine($file)
        $model = FileReadLine($file)
        $arrive = FileReadLine($file)
        $depart = FileReadLine($file)
        $expense = FileReadLine($file)
        $start = FileReadLine($file)
        $end = FileReadLine($file)
        $comment = FileReadLine($file)
        $date = @MON & "/" & @MDAY & "/" & @YEAR
;$time = @HOUR & ":" & @MIN
;$mess = $name & " " & $date & " " & $time & @LF
        FileClose($file)
        FileDelete($a)
        $a = "C:\Inetpub\wwwroot\mitch\mileage.txt"
        $file = FileOpen($a, 1)
        FileWriteLine($file, $date)
        FileWriteLine($file, $name)
        FileWriteLine($file, $model)
        FileWriteLine($file, $arrive)
        FileWriteLine($file, $depart)
        FileWriteLine($file, $expense)
        FileWriteLine($file, $start)
        FileWriteLine($file, $end)
        FileWriteLine($file, $comment)
        FileWriteLine($file, "***")
        FileClose($file)
;### Tidy Error: Level error -> Until is closing previous if
    Until $d = "HELPMESTOPTHISCRAzything12344321"
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...