Jump to content

ElseIf Syntax error


Recommended Posts

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

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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

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?

Link to comment
Share on other sites

  • Developers
4 minutes ago, LoneWolf_2106 said:

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

Don't we need to whole code to try?

Jos

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

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.

Link to comment
Share on other sites

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