Jump to content
LoneWolf_2106

ElseIf Syntax error

Recommended Posts

LoneWolf_2106

Dear all,

sorry for the stupid question, i have added an ElseIf to my function and i get "Syntax error", i don't understand the reason.

 

Global $configuration_search=_ArraySearch($content_array,"configuration",0,0,0,1,1,0)
    MsgBox($MB_OK, "test",@error)

    if @error = 6 then

    $folder_search[0][0] = "configuration" And $folder_search[0][1] = "not in use"

    ElseIf $configuration_search <> -1 Then $content_array[$configuration_search][1] = "in use" And $folder_search[0][0] = $content_array[$configuration_search][0] And $folder_search[0][1] = "in use"

_ArrayDisplay($folder_search)
    EndIf

Can anyone support me to understand?

Thanks in advance

Share this post


Link to post
Share on other sites
RTFC
ElseIf $configuration_search <> -1 Then
        $content_array[$configuration_search][1] = "in use"
        $folder_search[0][0] = $content_array[$configuration_search][0]
        $folder_search[0][1] = "in use"

You can't catenate multiple statements with a logical "And" operator!:blink:

Share this post


Link to post
Share on other sites
LoneWolf_2106

solved, "then" on one line and the rest on the bottom line 

 

ElseIf $configuration_search <> -1 Then

$content_array[$configuration_search][1] = "in use" And $folder_search[0][0] = $content_array[$configuration_search][0] And $folder_search[0][1] = "in use"

And then i have removed the And

Edited by LoneWolf_2106

Share this post


Link to post
Share on other sites
LoneWolf_2106

How can i close/delete this topic?

Share this post


Link to post
Share on other sites
LoneWolf_2106

Now i have another issue which also i don't understand:

If the value i search for is not present in the array and i have @error=6, it doesn't write anything in the array folder_search.

I have tried to show MsgBox after the if, but it seems to be totally skipped.

 

Global $workspace_search=_ArraySearch($content_array,"workspace",0,0,0,1,1,0)
    MsgBox($MB_OK, "test",@error)

    if @error = 6 then

        $folder_search[7][0] = "workspace"
        $folder_search[7][1] = "not in use"

    ElseIf $workspace_search <> -1 Then
        $content_array[$workspace_search][1] = "in use"
        $folder_search[7][0] = $content_array[$workspace_search][0]
        $folder_search[7][1] = "in use"
    EndIf

Can anyone try my code or explain me why the if is skipped?

Share this post


Link to post
Share on other sites
LoneWolf_2106

I didn't post the rest of the code, because it was just the array declaration.(the rest is just an Array having an item with a substring "workspace")

Anyway i have removed the MsgBox above the if and it seems to be working, even if i don't know why that behavior.

Share this post


Link to post
Share on other sites
Jos
11 minutes ago, LoneWolf_2106 said:

I didn't post the rest of the code, because it was just the array declaration.

Doubt that ... anyway, when you want us to run/test a script, you will have to post a version that we can run without having to add code to it.

Jos


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

Share this post


Link to post
Share on other sites
LoneWolf_2106
4 minutes ago, Jos said:

Doubt that ... anyway, when you want us to run/test a script, you will have to post a version that we can run without having to add code to it.

Jos

alright, next time i will do it, thanks for your support :-)

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

×