ichigo325 Posted December 13, 2009 Share Posted December 13, 2009 Hi guys, i'm trying to create some gui banner just like NSIS banner plug-in (Link) but my banner more simple than that. But when i try to insert it in my full script, it make my pc not responding or 100% cpu usage.. I want you guys check my script or maybe you can make it even better than this. ThanksHere is my code:_Banner(1, Chr(149) & " loading wololo...") Sleep(3000) ;some other functions _Banner(1, @CRLF & Chr(149) & " loading wololo again...") ;update the banner with other strings/text Sleep(3000) _Banner(2) Func _Banner($mode, $text = "") Local $lGui, $lProgress, $lLabel If $mode = 1 Then If WinExists("Loading") <> 1 Then $lGui = GUICreate("Loading", 280, 50, -1, -1, 0x80000000 + 0x00400000) GUISetBkColor(0xffffff, $lGui) ;~ GUICtrlCreatePic($TempDir & "\Skin\Loading-Gradient.jpg", 0, 10, 280, 40) ;~ GUICtrlCreateAvi($TempDir & "\Skin\Loading.avi", -1, 8, 8, 32, 32, 0x04) GUICtrlCreateLabel("", 8, 8, 32, 32, 0x12) ;This is for loading.avi animation) GUISetState(@SW_SHOW) EndIf $lLabel = GUICtrlCreateLabel("", 52, 8, 222, 55) GUICtrlSetFont(-1, 11.5) GUICtrlSetColor(-1, 0x7d7d7d) GUICtrlSetBkColor(-1, -2) GUICtrlSetData($lLabel, GUICtrlRead($lLabel) & $text) While GUIGetMsg() <> -3 Return 0 WEnd ElseIf $mode = 2 Then GUIDelete($lGui) Return 0 EndIf EndFunc ;==>_Banner [size="2"][font="Lucida Sans Unicode"][b][/b][/font][/size] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 13, 2009 Moderators Share Posted December 13, 2009 ichigo325,Welcvome to the AutoIt forum. You have a problem becasue you have declared the GUI and Label as Local variables - so weach time you end the function, AutoIt loses their ControlIDs. If you declare them as Global variables all is well:Global $lGui, $lLabel $sText = Chr(149) & " loading wololo..." _Banner(1, $sText) Sleep(3000) ;some other functions $sText &= @CRLF & Chr(149) & " loading wololo again..." ;update the banner with other strings/text ; <<<<<<< add new lines to text _Banner(1, $sText) Sleep(3000) _Banner(2) Func _Banner($mode, $text = "") Local $lProgress If $mode = 1 Then If WinExists("Loading") <> 1 Then $lGui = GUICreate("Loading", 280, 50, -1, -1, 0x80000000 + 0x00400000) GUISetBkColor(0xffffff, $lGui) ;~ GUICtrlCreatePic($TempDir & "\Skin\Loading-Gradient.jpg", 0, 10, 280, 40) ;~ GUICtrlCreateAvi($TempDir & "\Skin\Loading.avi", -1, 8, 8, 32, 32, 0x04) GUICtrlCreateLabel("", 8, 8, 32, 32, 0x12) ;This is for loading.avi animation) $lLabel = GUICtrlCreateLabel("", 52, 8, 222, 55) ; <<<<<<<< only cretae label once GUICtrlSetFont(-1, 11.5) GUICtrlSetColor(-1, 0x7d7d7d) GUICtrlSetBkColor(-1, -2) GUISetState(@SW_SHOW) EndIf GUICtrlSetData($lLabel, $sText) Else GUIDelete($lGui) EndIf EndFunc ;==>_BannerI changed a few other things as well - please ask if you do not understand why.Of interest, if we do get Static variables in the next update cycle, they would be perfect for this. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ichigo325 Posted December 13, 2009 Author Share Posted December 13, 2009 Works flawless.. Thanks for your help.. [size="2"][font="Lucida Sans Unicode"][b][/b][/font][/size] Link to comment Share on other sites More sharing options...
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