Bert Posted December 10, 2006 Share Posted December 10, 2006 I'm working on a marquee program and almost have it done. It works well, but I noticed when I exit the script a little problem happens. I have it so when the marquee closes, any windows that were maximized are put back into normal positions. The problem is the windows are slightly shifted to the right when this happens. Can someone test to see if it is just my PC, or is there a bug in my code? The script is currently designed to make a ini file when the first box scrolls off the GUI. The marquee is designed to change what is displayed if desired after a box has scrolled to the end of the GUI. expandcollapse popup#include <GUIConstants.au3> #Include <Constants.au3> $cc = WinGetTitle("") HotKeySet("^!q", "_exit") ;------------------------------------------ ;speed for marquee will be set in ini later AdlibEnable('_MoveMarquee', 15) ;------------------------------------------ $size = @DesktopWidth +3 DIM $mygui, $myl, $my2, $my3, $my4, $st $mygui = GUICreate('$$marque$$', $size, 18, -1, 0, $WS_POPUP, $WS_EX_TOPMOST) guisetfont(11.7, 500, 0, "ms comic san",$mygui) GUISetBkColor ( 0x000000, $mygui ) $myl = GUICtrlCreateLabel("Have a great day!", 0, -2) $my2 = GUICtrlCreateLabel("****", -800, -1) $my3 = GUICtrlCreateLabel("****", -1600, -1) $my4 = GUICtrlCreateLabel("****", -2400, -1) GUICtrlSetColor($myl, 0xff0000) GUICtrlSetColor($my2, 0x00FF00) GUICtrlSetColor($my3, 0xfff000) GUICtrlSetColor($my4, 0xffffff) GUISetState() WinActivate($cc) While GUIGetMsg() <> -3 sleep(1) WEnd Func _MoveMarquee() Local $aCpos1, $aCpos2, $aCpos3, $aCpos4 $a = WinGetTitle("") $b = WinGetPos($a) if $a = "$$marque$$" then sleep(1) Elseif $b[1]<=18 then winmove($a,"", $b[0], 18) endif $aCpos1 = ControlGetPos($mygui, '', $myl) $aCpos2 = ControlGetPos($mygui, '', $my2) $aCpos3 = ControlGetPos($mygui, '', $my3) $aCpos4 = ControlGetPos($mygui, '', $my4) if $aCpos1[0] >= $size then setsize1() $len = StringLen(GUICtrlRead($myl)) $lenth = $len * 10 $aCpos1[0] = - ($lenth +1600) Endif If $aCpos2[0] >= $size Then setsize2($my2) $len = StringLen(GUICtrlRead($myl)) $lenth = $len * 10 $aCpos2[0] = -($lenth +1600) endif If $aCpos3[0] >= $size Then setsize3($my3) $len = StringLen(GUICtrlRead($myl)) $lenth = $len * 10 $aCpos3[0] = -($lenth +1600) endif If $aCpos4[0] >= $size Then setsize4($my4) $len = StringLen(GUICtrlRead($myl)) $lenth = $len * 10 $aCpos4[0] = -($lenth + 1600) endif ControlMove($mygui, '', $myl, $aCpos1[0] + 1, $aCpos1[1]) ControlMove($mygui, '', $my2, $aCpos2[0] + 1, $aCpos2[1]) ControlMove($mygui, '', $my3, $aCpos3[0] + 1, $aCpos3[1]) ControlMove($mygui, '', $my4, $aCpos4[0] + 1, $aCpos4[1]) EndFunc func _exit() $list=WinList() For $i = 1 to $list[0][0] If $list[$i][0] <> "" AND WinGetState($list[$i][1]) = 39 Then WinMove($list[$i][1], "", 0, 0) EndIf next sleep(30) For $i = 1 to $list[0][0] If $list[$i][0] <> "" AND WinGetState($list[$i][1]) = 47 Then WinMove($list[$i][1], "", 0, 0) EndIf next exit EndFunc Func setsize1($font = 10) ;------------------ ; -section used for testing $sData = "user1 = 7" & @LF & "user2 = 8" & @LF & "user3 = 9"& @LF & "user4 = 8" & @LF & "user = 9" IniWriteSection(@ScriptDir&"/bin/settings.ini", "users", $sData) $inia2= IniReadSection(@ScriptDir&"/bin/settings.ini", "users") $text = "Theresa - "&$inia2[1][1] &" Charles - "&$inia2[2][1]&" Tammy - "&$inia2[3][1]&" John - "&$inia2[4][1]&" Andrew - "&$inia2[5][1] ; ----------------- GUICtrlSetData($myl, $text) $info1 = ControlGetPos("$$marque$$", "", $myl) $data1 = GUICtrlRead($myl) $lenth1 = StringLen($data1) $len1 = $lenth1 * 10 ControlMove("$$marque$$", "", $myl, $info1[0], $info1[1], $len1, $info1[3]) EndFunc Func setsize2($control, $font = 10) ;------------------ ; -section used for testing $inia2= IniReadSection(@ScriptDir&"/bin/settings.ini", "users") $text = "Theresa - "&$inia2[1][1] &" Charles - "&$inia2[2][1]&" Tammy - "&$inia2[3][1]&" John - "&$inia2[4][1]&" Andrew - "&$inia2[5][1] ; ----------------- GUICtrlSetData( $control, $text) $info = ControlGetPos("$$marque$$", "", $control) $data = GUICtrlRead($control) $lenth = StringLen($data) $len = $lenth * 10 ControlMove("$$marque$$", "", $control, $info[0], $info[1], $len, $info[3]) EndFunc Func setsize3($control, $font = 10) ;------------------ ; -section used for testing $inia2= IniReadSection(@ScriptDir&"/bin/settings.ini", "users") $text = "Theresa - "&$inia2[1][1] &" Charles - "&$inia2[2][1]&" Tammy - "&$inia2[3][1]&" John - "&$inia2[4][1]&" Andrew - "&$inia2[5][1] ; ----------------- GUICtrlSetData( $control, $text) $info = ControlGetPos("$$marque$$", "", $control) $data = GUICtrlRead($control) $lenth = StringLen($data) $len = $lenth * 10 ControlMove("$$marque$$", "", $control, $info[0], $info[1], $len , $info[3]) EndFunc Func setsize4($control, $font = 10) ;------------------ ; -section used for testing $inia2= IniReadSection(@ScriptDir&"/bin/settings.ini", "users") $text = "Theresa - "&$inia2[1][1] &" Charles - "&$inia2[2][1]&" Tammy - "&$inia2[3][1]&" John - "&$inia2[4][1]&" Andrew - "&$inia2[5][1] ;~ ; ----------------- GUICtrlSetData( $control, $text) $info = ControlGetPos("$$marque$$", "", $control) $data = GUICtrlRead($control) $lenth = StringLen($data) $len = $lenth * 10 ControlMove("$$marque$$", "", $control, $info[0], $info[1], $len, $info[3]) EndFunc The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
GaryFrost Posted December 10, 2006 Share Posted December 10, 2006 Maybe? DIM $mygui, $myl, $my2, $my3, $my4, $st, $list1 oÝ÷ Ù«¢+Ø)Õ¹=¹Õѽ%ÑMÑÉÐ ¤($ÀÌØí±¥ÍÑ}ѵÀô]¥¹1¥ÍÐ ¤(%±½°ÀÌØí±¥ÍÐÅmU ½Õ¹ ÀÌØí±¥ÍÑ}ѵÀ¤¬ÅulÍt($ÀÌØí±¥ÍÐÅlÁulÁtôÀÌØí±¥ÍÑ}ѵÁlÁulÁt(%½ÈÀÌØíàôÄQ¼ÀÌØí±¥ÍÐÅlÁulÁt($$ÀÌØí±¥ÍÐÅlÀÌØíáulÁtôÀÌØí±¥ÍÑ}ѵÁlÀÌØíáulÁt($$ÀÌØí±¥ÍÐÅlÀÌØíáulÅtôÀÌØí±¥ÍÑ}ѵÁlÀÌØíáulÅt($$ÀÌØí±¥ÍÐÅlÀÌØíáulÉtô ¥Ñ9¡]¥¹ÑMÑÑ ÀÌØí±¥ÍÑ}ѵÁlÀÌØíáulÁt¤°ÌȤ(%9áÐ)¹Õ¹()Õ¹}á¥Ð ¤(ÀÌØí±¥ÍÐõ]¥¹1¥ÍÐ ¤(½ÈÀÌØí¤ôÄѼÀÌØí±¥ÍÑlÁulÁt($$½ÈÀÌØíàôÄQ¼ÀÌØí±¥ÍÐÅlÁulÁt($$%ÀÌØí±¥ÍÑlÀÌØí¥ulÁt±ÐìÐìÅÕ½ÐìÅÕ½Ðì¹ ÀÌØí±¥ÍÑlÀÌØí¥ulÁtôÀÌØí±¥ÍÐÅlÀÌØíáulÁt¹ÀÌØí±¥ÍÐÅlÀÌØíáulÉtôÌȤQ¡¸($$$]¥¹MÑMÑÑ ÀÌØí±¥ÍÑlÀÌØí¥ulÁt°ÅÕ½ÐìÅÕ½Ðì°M]}5a%5%i¤($$¹%($%9áÐ(¹áÐ)á¥Ð)¹Õ¹ SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Bert Posted December 11, 2006 Author Share Posted December 11, 2006 (edited) Tried it, and if a window currently exist, but is inactive, it doesn't see it. The effect is it sits on top the titlebar of the window. Also, when exiting, it won't resize the windows back to standard. I'm beginning to think I need to have the window part of the script in a separate program, and have it just do that to make it stable. Then I would have the Marquee part run by it self. I'm also now having trouble when a new window is opened. I suspect when the loop is in a certain spot when the window opens, I get this error: G:\AU3 scripts\marque\marque.au3 (48) : ==> Subscript used with non-Array variable.: Elseif $b[1]<=18 then Elseif $b^ ERRORCurrent script. THis has code in it to work as a demo. In the future, it will be pulling information from a excel spreadsheet: expandcollapse popup#include <GUIConstants.au3> #Include <Constants.au3> #include <Misc.au3> #include <Date.au3> _Singleton("test.au3") $cc = WinGetTitle("") Dim $Wdata, $msg, $station, $WdataA HotKeySet("^!q", "_exit") $Station = "KRIC" _Update() sleep(500) ;------------------------------------------ ;speed for marquee will be set in ini later AdlibEnable('_MoveMarquee', 10) ;------------------------------------------ DIM $mygui, $myl, $my2, $my3, $my4, $size, $list1 Global $aCpos1, $aCpos2, $aCpos3, $aCpos4 $size = @DesktopWidth +15 $date1=_DateTimeFormat( _NowCalc(), 1) $mygui = GUICreate('$$marque$$', $size, 18, -3, 0, $WS_POPUP, $WS_EX_TOPMOST) guisetfont(11.7, 600, 0, "ms comic san",$mygui) GUISetBkColor ( 0x000000, $mygui ) $myl = GUICtrlCreateLabel("Today is "&$date1, 0, -10) $my2 = GUICtrlCreateLabel($Wdata, -800, -1) $my3 = GUICtrlCreateLabel("Have a great day!", -1600, -1) $my4 = GUICtrlCreateLabel("****", -2400, -1) GUICtrlSetColor($myl, 0xff0000) GUICtrlSetColor($my2, 0x00FF00) GUICtrlSetColor($my3, 0xfff000) GUICtrlSetColor($my4, 0xffffff) GUISetState(@SW_SHOW) sleep(50) GUISetState(@SW_DISABLE) WinActivate($cc) While GUIGetMsg() <> -3 sleep(1) WEnd Func _MoveMarquee() Local $aCpos1, $aCpos2, $aCpos3, $aCpos4 $a = WinGetTitle("") $b = WinGetPos($a) if $a = "$$marque$$" then GUISetState(@SW_DISABLE) Elseif $b[1]<=18 then winmove($a,"", $b[0], 18) endif $aCpos1 = ControlGetPos($mygui, '', $myl) $aCpos2 = ControlGetPos($mygui, '', $my2) $aCpos3 = ControlGetPos($mygui, '', $my3) $aCpos4 = ControlGetPos($mygui, '', $my4) if WinExists($mygui) then if $aCpos1[0] >= $size then setsize1() $len = StringLen(GUICtrlRead($myl)) $lenth = ($len * 10) $aCpos1[0] = - ($lenth +1600) Endif Endif if WinExists($mygui) then If $aCpos2[0] >= $size Then setsize2($my2) $len = StringLen(GUICtrlRead($myl)) $lenth = ($len * 10) $aCpos2[0] = -($lenth +1600) endif EndIf if WinExists($mygui) then If $aCpos3[0] >= $size Then setsize3($my3) $len = StringLen(GUICtrlRead($myl)) $lenth = ($len * 10) $aCpos3[0] = -($lenth +1600) endif endif if WinExists($mygui) then If $aCpos4[0] >= $size Then setsize4($my4) $len = StringLen(GUICtrlRead($myl)) $lenth = ($len * 10) $aCpos4[0] = -($lenth + 1600) endif endif if WinExists($mygui) then ControlMove($mygui, '', $myl, $aCpos1[0] + 1, $aCpos1[1]) if WinExists($mygui) then ControlMove($mygui, '', $my2, $aCpos2[0] + 1, $aCpos2[1]) if WinExists($mygui) then ControlMove($mygui, '', $my3, $aCpos3[0] + 1, $aCpos3[1]) if WinExists($mygui) then ControlMove($mygui, '', $my4, $aCpos4[0] + 1, $aCpos4[1]) EndFunc func _exit() GUIDelete($mygui) sleep(500) $list=WinList() For $i = 1 to $list[0][0] If $list[$i][0] <> "" AND WinGetState($list[$i][1]) = 39 Then WinMove($list[$i][1], "", -4, 0) EndIf next sleep(100) For $i = 1 to $list[0][0] If $list[$i][0] <> "" AND WinGetState($list[$i][1]) = 47 Then WinMove($list[$i][1], "", -4, 0) EndIf next exit EndFunc ;~ Func OnAutoItStart() ;doesn't work????? ;~ $list_temp = WinList() ;~ Global $list1[UBound($list_temp) + 1][3] ;~ $list1[0][0] = $list_temp[0][0] ;~ sleep(200) ;~ For $x = 1 To $list1[0][0] ;~ $list1[$x][0] = $list_temp[$x][0] ;~ $list1[$x][1] = $list_temp[$x][1] ;~ $list1[$x][2] = BitAND(WinGetState($list_temp[$x][0]),32) ;~ Next ;~ EndFunc ;~ func _exit() ;doesn't work????? ;~ $list=WinList() ;~ sleep(500) ;~ For $i = 1 to $list[0][0] ;~ For $x = 1 To $list1[0][0] ;~ If $list[$i][0] <> "" And ($list[$i][0] = $list1[$x][0] And $list1[$x][2] = 32) Then ;~ WinSetState($list[$i][0],"", @SW_MAXIMIZE ) ;~ EndIf ;~ Next ;~ next ;~ exit ;~ EndFunc Func setsize1($font = 10) ;------------------ ; -section used for testing ;~ $sData = "user1 = 7" & @LF & "user2 = 8" & @LF & "user3 = 9"& @LF & "user4 = 8" & @LF & "user = 9" ;~ IniWriteSection(@ScriptDir&"/bin/settings.ini", "users", $sData) ;MsgBox(0, "", "") $inia2= IniReadSection(@ScriptDir&"/bin/settings.ini", "users") $text = "Theresa - "&$inia2[1][1] &" Charles - "&$inia2[2][1]&" Tammy - "&$inia2[3][1]&" John - "&$inia2[4][1]&" Andrew - "&$inia2[5][1] ; ----------------- GUICtrlSetData($myl, $text) $info1 = ControlGetPos("$$marque$$", "", $myl) $data1 = GUICtrlRead($myl) $lenth1 = StringLen($data1) $len1 = $lenth1 * 10 ControlMove("$$marque$$", "", $myl, $info1[0], $info1[1], $len1, $info1[3]) EndFunc Func setsize2($control, $font = 10) ;------------------ ; -section used for testing $inia2= IniReadSection(@ScriptDir&"/bin/settings.ini", "users") $text = "Theresa - "&$inia2[1][1] &" Charles - "&$inia2[2][1]&" Tammy - "&$inia2[3][1]&" John - "&$inia2[4][1]&" Andrew - "&$inia2[5][1] ; ----------------- GUICtrlSetData( $control, $text) $info = ControlGetPos("$$marque$$", "", $control) $data = GUICtrlRead($control) $lenth = StringLen($data) $len = $lenth * 10 ControlMove("$$marque$$", "", $control, $info[0], $info[1], $len, $info[3]) EndFunc Func setsize3($control, $font = 10) ;------------------ ; -section used for testing $inia2= IniReadSection(@ScriptDir&"/bin/settings.ini", "users") $text = "Theresa - "&$inia2[1][1] &" Charles - "&$inia2[2][1]&" Tammy - "&$inia2[3][1]&" John - "&$inia2[4][1]&" Andrew - "&$inia2[5][1] ; ----------------- GUICtrlSetData( $control, $text) $info = ControlGetPos("$$marque$$", "", $control) $data = GUICtrlRead($control) $lenth = StringLen($data) $len = $lenth * 10 ControlMove("$$marque$$", "", $control, $info[0], $info[1], $len , $info[3]) EndFunc Func setsize4($control, $font = 10) ;------------------ ; -section used for testing $inia2= IniReadSection(@ScriptDir&"/bin/settings.ini", "users") $text = "Theresa - "&$inia2[1][1] &" Charles - "&$inia2[2][1]&" Tammy - "&$inia2[3][1]&" John - "&$inia2[4][1]&" Andrew - "&$inia2[5][1] ;~ ; ----------------- GUICtrlSetData( $control, $text) $info = ControlGetPos("$$marque$$", "", $control) $data = GUICtrlRead($control) $lenth = StringLen($data) $len = $lenth * 10 ControlMove("$$marque$$", "", $control, $info[0], $info[1], $len, $info[3]) EndFunc Func _Update() ;SplashTextOn("Updating", "Retrieving Data", 100, 30, -1, -1, 33, "", 9, 800) $WdataAvail = Inetget("http://www.nws.noaa.gov/data/current_obs/" & $Station & ".xml", @TempDir & "\weather.xml", 1, 0) If $WdataAvail <> 1 Then for $i = 1 to 3 Sleep(3000) $WdataAvail = Inetget("http://www.nws.noaa.gov/data/current_obs/" & $Station & ".xml", @TempDir & "\weather.xml", 1, 0) If $WdataAvail = 1 Then ExitLoop EndIf Next MsgBox(262144, "Data Not Available!", "The Weather data is currently not available." & @CRLF & "Please try later. CC weather will now exit.") Exit EndIf $oXml = ObjCreate("Msxml2.DOMdocument.3.0") $oXml.async=0 $oXml.Load(@tempdir & "\weather.xml") $oXmlroot = $oXml.documentElement For $oXmlNode In $oXmlroot.childNodes Select Case $oXmlnode.nodename = "observation_time" $time = $oXmlnode.text Case $oXmlnode.nodename = "location" $loc = $oXmlnode.text Case $oXmlnode.nodename = "temperature_string" $tmp = $oXmlnode.text Case $oXmlnode.nodename = "weather" $wea = $oXmlnode.text Case $oXmlnode.nodename = "relative_humidity" $rh = $oXmlnode.text Case $oXmlnode.nodename = "wind_string" $windstr = $oXmlnode.text Case $oXmlnode.nodename = "wind_dir" $winddir = $oXmlnode.text Case $oXmlnode.nodename = "pressure_string" $pr = $oXmlnode.text Case $oXmlnode.nodename = "heat_index_string" $index = $oXmlnode.text Case $oXmlnode.nodename = "wind_mph" $wind = $oXmlnode.text Case $oXmlnode.nodename = "windchill_string" $chill = $oXmlnode.text Case $oXmlnode.nodename = "visibility_mi" $vis = $oXmlnode.text EndSelect Next If $chill <> "NA" Then $WdataA = " Wind Chill: " & $chill ElseIf $index <> "NA" Then $WdataA = " Heat Index: " & $index EndIf $Wdata = "Current Weather Conditions: " & $wea & ", " & $tmp & " Wind " & $windstr &", "&$WdataA EndFunc Edited December 11, 2006 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted December 11, 2006 Author Share Posted December 11, 2006 (edited) I found a second problem, and I think this is a bug with AutoIt. If I run the script with FireFox running, all the controls in the Firefox window are not accessable in that they will work for a moment. If you click on a control it simply "blinks" for a second then dissapears. A example is the menu bar. I click on file, and the dropdown menu will blink. Very odd. I tested it with other programs, and had no issue. IE, office, Roxio, SciTe, WinBatch Studio, NetOp, Mcafee VirusScan, and Altiris Carbon copy were the applications I tested. I also tested it on 2 PCs, my laptop at home (XP home SP2, and my work PC (XP pro SP2)Edit: I'm running the latest beta and latest production versions of AutoIt Edited December 11, 2006 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted December 12, 2006 Author Share Posted December 12, 2006 bump The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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