Kivin Posted January 27, 2007 Posted January 27, 2007 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
Moderators SmOke_N Posted January 27, 2007 Moderators Posted January 27, 2007 Hi everyone! How I can specify "Do nothing" in Conditionally run statements. For example: If $1=1 Then FileOpen ($2, 1) else "Do nothing" EndIfIf $1 = 1 Then FileOpen(etc) EndIfIf 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.
BrettF Posted January 27, 2007 Posted January 27, 2007 If $1=1 ThenFileOpen ($2, 1)Else;Nothing goes here.EndIf Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Lej Posted January 27, 2007 Posted January 27, 2007 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
Kivin Posted January 27, 2007 Author Posted January 27, 2007 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!
xcal Posted January 27, 2007 Posted January 27, 2007 If Not @error Then GUICtrlSetData ( $SourceInput, $TempVariable ) IniWrite ( @ScriptDir & "\Option.ini", "Path", "SourcePath" , $TempVariable) EndIf How To Ask Questions The Smart Way
Lej Posted January 27, 2007 Posted January 27, 2007 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...
Moderators SmOke_N Posted January 27, 2007 Moderators Posted January 27, 2007 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now