Jump to content

Missing EndIf?


RobertK
 Share

Recommended Posts

Hi there,

I just started learning this language, and I have a sample script in front of me.

I've already got several years of experience in PHP and that kind of languages, and this looks a little similar.

I have this code:

$StartProg = ("C:\windows\system32\mshta.exe")
$ArgMen = ("C:\test\hello.hta")
$WorkDir = ("C:\test")

if FileExists( "C:\AUTEST\v11.osx" ) Then
    Run ( $StartProg & " " & $ArgMen, $WorkDir )
Else
    if FileExists( "C:\AUTEST" ) Then   
        Sleep(10)
        Else
                DirCreate( "C:\AUTEST" )
        EndIf
ElseIf

The only problem is, I recon that this could be done a little easier by checking if the FileExists functions returns false and then create a directory.

For example:

$StartProg = ("C:\windows\system32\mshta.exe")
$ArgMen = ("C:\test\hello.hta")
$WorkDir = ("C:\test")


if FileExists( "C:\AUTEST\v11.osx" ) Then
    Run ( $StartProg & " " & $ArgMen, $WorkDir )
Else
    if ( FileExists( "C:\AUTEST" ) == False ) Then  
        DirCreate( "C:\AUTEST" )
    EndIf
ElseIf

But this doesn't seem to work, it doesn't create a directory.

Thanks in advance,

Robert

EDIT:

sorry for the lame title, first I had a problem with something like "Missing EndIf" but that problem is solved, I wrote ElseIf in stead of EndIf.

But I can't change my title :)

Edited by RobertK

[font="Verdana"]I've gone to find myself. If I get back before I return, please keep me here.[/font]

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