#include #include #include #include #include #include "GIFAnimation.au3" Global $RunningGIF1 Opt("GUIOnEventMode", 1) $Gui = GUICreate("Main GUI", 400, 400, -1, -1) $hTab = GUICtrlCreateTab(5, 5, 390, 390) $Control = GUICtrlCreateTabItem('Tab0') $Runbutton = GUICtrlCreateButton("Run", 20, 50, 50, 50) GUICtrlSetOnEvent($Runbutton, "action") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUICtrlCreateTabItem("Tab1") GUICtrlCreateTabItem("") GUISetState() $iLastTab = 0 While 1 ; Check which Tab is active $iCurrTab = GUICtrlRead($hTab) ; If the Tab has changed If $iCurrTab <> $iLastTab Then ; Show/Hide controls as required Switch $iCurrTab Case 0 ConsoleWrite('On tab 0' & @CRLF) GUICtrlSetState($RunningGIF1, $GUI_SHOW) Case 1 ConsoleWrite('On tab 1' & @CRLF) GUICtrlSetState($RunningGIF1, $GUI_HIDE) EndSwitch ; Store the value for future comparisons $iLastTab = $iCurrTab EndIf Sleep(100) WEnd Func action() ConsoleWrite('Running.....' & @CRLF) $RunningGIF1 = _GUICtrlCreateGIF('C:\Program Files (x86)\AutoIt3\Icons\au3.ico', "", 150, 150, 100, 100) Sleep(5000) ConsoleWrite('Finished Running.....' & @CRLF) EndFunc ;==>action Func Close() Exit EndFunc ;==>Close