Sign in to follow this  
Followers 0
Wb-FreeKill

Case statements

7 posts in this topic

Why is this generating an error?

$Bah = 1

Case $Bah = 1

$Counter = $Counter +1

GetInList()

"Variable not found"

Share this post


Link to post
Share on other sites



You need to use the correct syntax for the Select...Case...EndSelect statement and you need to initialize you counter variable...

$Bah = 1
$Counter = 0
Select
    Case $Bah = 1
        $Counter = $Counter + 1
        GetInList()
EndSelect


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Try this...

Dim $Counter
Do While 1
  $Bah = 1
  Select 
    Case $Bah = 1 
    $Counter = $Counter +1
    GetInList()
  EndSelect
Wend

Share this post


Link to post
Share on other sites

You need to use the correct syntax for the Select...Case...EndSelect statement and you need to initialize you counter variable...

$Bah = 1
$Counter = 0
Select
    Case $Bah = 1
        $Counter = $Counter + 1
        GetInList()
EndSelect

<{POST_SNAPBACK}>

O, i know about the Select,EndSelect... but i guess the error occurs because the variable is in the Select,EndSelect

You can do this:

$Var = 1

Select

------Case $var = 1

------------Msgbox(0,"","")

EndSelect

But not this:

Select

$Var = 1

------Case $var = 1

------------Msgbox(0,"","")

EndSelect

Right, i guess that's my problem..

Share this post


Link to post
Share on other sites

Correct. Select is only going to execute code conditionally based on the results of the subsequent case statements.

Please post more complete code examples in the future (preferably enough to execute stand-alone) and you're likely to get the answer you need the first time. Based on your base post, I could only guess that you hadn't even read the syntax of the Select statement.

Thanks,

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Please post more complete code examples in the future (preferably enough to execute stand-alone) and you're likely to get the answer you need the first time. 

Preach it, Brother.

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Share this post


Link to post
Share on other sites

Yeah i know, sry :(

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