Jump to content
Sign in to follow this  
Kivin

Do nothing

Recommended Posts

Kivin

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
SmOke_N

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 :)

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.

Share this post


Link to post
Share on other sites
BrettF
Lej

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
Kivin

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
Lej

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
SmOke_N

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


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.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.