Sign in to follow this  
Followers 0
RobertK

Missing EndIf?

4 posts in this topic

#1 ·  Posted (edited)

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]

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

If NOT fileExists() then ....

Thank you for the fast reply.

It works :)

Edited by RobertK

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

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