Jump to content

Do nothing


Kivin
 Share

Recommended Posts

  • Moderators

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.

Link to comment
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!

Link to comment
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...

Link to comment
Share on other sites

  • Moderators

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.

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