Sign in to follow this  
Followers 0
Kivin

Do nothing

9 posts in this topic

Hi everyone!

How I can specify "Do nothing" in Conditionally run statements.

For example:

If $1=1 Then

FileOpen ($2, 1)

else

"Do nothing"

EndIf

Share this post


Link to post
Share on other sites



Hi everyone!

How I can specify "Do nothing" in Conditionally run statements.

For example:

If $1=1 Then

FileOpen ($2, 1)

else

"Do nothing"

EndIf

If $1 = 1 Then
    FileOpen(etc)
EndIf
If you don't include the "Else" then it won't do anything :)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Couldn't you just skip the "else"?

If $1 == 1 Then
    FileOpen ($2, 1)
EndIf

And btw using numbers as variable names are probably going to get messy :)

Share this post


Link to post
Share on other sites

Part of script:

$SourcePath     = IniRead (@ScriptDir & "\Option.ini", "Path", "SourcePath", "" )
$SourceInput    = GUICtrlCreateInput ( $SourcePath, 100, 8, 400, 20 )

Func BrowseFile ()
    $TempVariable = FileOpenDialog  ( "Choose file", $SourcePath, "Playlist (*.m3u)|All files (*.*)",1)
    If @error Then
                    "Do nothing"
    Else
                    GUICtrlSetData  ( $SourceInput, $TempVariable )
                    IniWrite        ( @ScriptDir & "\Option.ini", "Path", "SourcePath"      , $TempVariable)
    EndIf   
EndFunc

I want, that if @error then $SourceInput stay as it is

Thanks for help!

Share this post


Link to post
Share on other sites

Think both these should work:

Func BrowseFile ()
    $TempVariable = FileOpenDialog  ( "Choose file", $SourcePath, "Playlist (*.m3u)|All files (*.*)",1)
    If @error Then
                    ;Do nothing
    Else
                    GUICtrlSetData  ( $SourceInput, $TempVariable )
                    IniWrite       ( @ScriptDir & "\Option.ini", "Path", "SourcePath"  , $TempVariable)
    EndIf   
EndFuncoÝ÷ ÚÚºÚ"µÍ[ÈÝÜÙQ[H

B   ÌÍÕ[XXHH[SÜ[X[ÙÈ
    ][ÝÐÚÛÜÙH[I][ÝË ÌÍÔÛÝÙT]  ][ÝÔ^[Ý

LÝJ_[[È

I][ÝËJBYÝÜ[ÕRPÝÙ]]H
    ÌÍÔÛÝÙR[] ÌÍÕ[XXH
B[UÜ]H
ØÜ    [È ][ÝÉÌLÓÜ[Û[I][ÝË    ][ÝÔ] ][ÝË  ][ÝÔÛÝÙT]  ][ÝÈ  ÌÍÕ[XXJB[Y[[

Let's hope I understood what you meant...

Share this post


Link to post
Share on other sites

Func BrowseFile()
    $TempVariable = FileOpenDialog  ( "Choose file", $SourcePath, "Playlist (*.m3u)|All files (*.*)",1)
    If @error Then Return SetError(1, 0, 0)
    GUICtrlSetData($SourceInput, $TempVariable)
    Return IniWrite( @ScriptDir & "\Option.ini", "Path", "SourcePath", $TempVariable)
EndFunc


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thank you very much for help!

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