E1M1 Posted April 30, 2009 Share Posted April 30, 2009 (edited) Sorry for my bad english. Hi How I must change my script? 1)I want "Time to action:" Always be in red color 2) I want "TIME" change it's color in every second, and I want It go from green to red(it should look like Health bar that changes it's color when value decreases), but instead of RGB my autoit uses BGR, how I could force autoit use RGB system? Why "Time to action:" is in black color if I told it to be Red? I also wanna calculate color change amount, but it seems not working, so I need some suggestions about that too. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $time = 5*60 $R = 0 $G = 255 $step = $time / 255 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Action", 440, 50, 0, 0,0x96000000,0x00000080) GUISetBkColor(0xFFFFFF,$Form1) $Label1 = GUICtrlCreateLabel("Time to action:", 0, 8, 820, 50) GUICtrlSetFont(-1, 24, 800, 0, "Courier New") GUICtrlSetColor($Label1, 0xFF0000) $Label2 = GUICtrlCreateLabel("TIME", 360, 8, 75, 50) GUICtrlSetFont(-1, 24, 800, 0, "Courier New") GUICtrlSetColor(-1, "0x"&Hex($R,2)&Hex($G,2)&00) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;~ For $i = 1 To 96 ;~ WinSetTrans("Arvuti_sulgemine","",255 - $i) ;~ Sleep(50) ;~ Next While 1 Sleep(1000) ;~ MsgBox(1,hex($R,2),Hex($G,2)) $R = $R + $step $G = $G - $step $time = $time - 1 $text = Int($time / 60) GUICtrlSetData($Label2,$text&":"&$time - ($text * 60 )) GUICtrlSetColor($Label2,"0x"&hex($R,2)&Hex($G,2)&00) WEnd Edited April 30, 2009 by E1M1 edited Link to comment Share on other sites More sharing options...
Yashied Posted April 30, 2009 Share Posted April 30, 2009 (edited) Try this.GUICtrlSetColor($Label2, BitShift($R, -16) + BitShift($G, -8))EDIT: If we look at your example you had to write down the following way.GUICtrlSetColor($Label2, "0x" & Hex($R, 2) & Hex($G, 2) & "00") Edited April 30, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
E1M1 Posted April 30, 2009 Author Share Posted April 30, 2009 (edited) Ok now I need help with that color step calculator , it gets red when the time is about 1:20 and then ig gets back to green. how to avoid that? Why is "Time to action:" in black color? Edit: I had never used BitShift() in autoit GUI-s It walways worked with out it, why it dont work at this time? expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $time = 5*60 $R = 0 $G = 255 $step = $time / 255 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Action", 440, 50, 0, 0,0x96000000,0x00000080) GUISetBkColor(0xFFFFFF,$Form1) $Label1 = GUICtrlCreateLabel("Time to action:", 0, 8, 820, 50) GUICtrlSetFont(-1, 24, 800, 0, "Courier New") GUICtrlSetColor($Label1, 0xFF0000) $Label2 = GUICtrlCreateLabel("TIME", 360, 8, 75, 50) GUICtrlSetFont(-1, 24, 800, 0, "Courier New") GUICtrlSetColor(-1, "0x"&Hex($R,2)&Hex($G,2)&00) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;~ For $i = 1 To 96 ;~ WinSetTrans("Arvuti_sulgemine","",255 - $i) ;~ Sleep(50) ;~ Next While 1 Sleep(100) $R = $R + $step $G = $G - $step $time = $time - 1 $text = Int($time / 60) GUICtrlSetData($Label2,$text&":"&$time - ($text * 60 )) GUICtrlSetColor($Label2, BitShift($R, -16) + BitShift($G, -8)) WEndoÝ÷ ÙaØwèZ0x,r¸©¶+p¢¹,jëh×6#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 172, 77, 193, 125) GUISetFont(26, 800, 0, "Palatino Linotype") $Label1 = GUICtrlCreateLabel("Label1", 24, 8, 110, 51) GUICtrlSetColor(-1, 0xFF0000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited April 30, 2009 by E1M1 edited Link to comment Share on other sites More sharing options...
Yashied Posted April 30, 2009 Share Posted April 30, 2009 (edited) Ok now I need help with that color step calculator , it gets red when the time is about 1:20 and then ig gets back to green. how to avoid that?My friend, it was necessary to teach mathematics. $step = 255 / $time Why is "Time to action:" in black color?$Form1 = GUICreate("Action", 440, 50, 0, 0,0x96000000,0x00000080) Where are you taking these values to the styles. This is because of them. WHY in following script it works???? http://www.autoitscript.com/autoit3/docs/functions/BitShift.htm Edited April 30, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
E1M1 Posted April 30, 2009 Author Share Posted April 30, 2009 Great Thanks it works now edited Link to comment Share on other sites More sharing options...
trancexx Posted April 30, 2009 Share Posted April 30, 2009 ... anyway, it was $WS_CLIPCHILDREN style that caused that. ♡♡♡ . eMyvnE 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