Norsestar Posted November 28, 2007 Share Posted November 28, 2007 i won't be able to post the full code im working with as it would be too much work to chop it down in 10 minutes before i go to lunch, but here's the menuitems i have: $red = guictrlcreatemenuitem("Red", $menu_background) $orange = guictrlcreatemenuitem("Orange", $menu_background) $yellow = guictrlcreatemenuitem("Yellow", $menu_background) $green = guictrlcreatemenuitem("Green", $menu_background) $blue = guictrlcreatemenuitem("Blue", $menu_background) $ black = guictrlcreatemenuitem("Black", $menu_background) $purple = guictrlcreatemenuitem("Purple", $menu_background) and i've tried using case $msg[0] = $green guictrlsetbkcolor (-1, 0x00ff00) any ideas? i can't seem to get it to work for me. Thanks much in advance Education: Francis Tuttle Technology Center adult full-time studentCourse of study: Network TechnologyCurrent Course: Microsoft Windows Server 2003, Enterprise EditionCompleted Courses: CompTIA A+ Hardware and Software, Windows XP Professional, Microsoft Office 2003, Desktop Support and Troubleshooting, and CompTIA Network+Remaining Courses: Linux Administration, Copper Cabling, Microsoft Windows Server 2003, Enterprise EditionAchievements: @17 years old, scored 98th percentile U.S. in Algebra 2 and Advanced Chemistry. [i.e. Ranked top 2% in the nation of High School students] Link to comment Share on other sites More sharing options...
Developers Jos Posted November 28, 2007 Developers Share Posted November 28, 2007 (edited) i won't be able to post the full code im working with as it would be too much work to chop it down in 10 minutes before i go to lunch, but here's the menuitems i have:Cut & Paste should be no more that 10 seconds guictrlsetbkcolor (-1, 0x00ff00)Why are you using -1 for the controlhandle ?Replace it with the variable that contains the handle of the control you are trying to change to see if that works ... Edited November 28, 2007 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Norsestar Posted November 28, 2007 Author Share Posted November 28, 2007 well, im back from lunch. i tried replacing -1 with $green and it didn't work. it shows up as processing it, but the bg stays black. now that i have more time, i can post the entire script. NOTE: i did not create it from scratch, i copied it off the forums and did a little bit of editing to set it to my personal liking. i forget exactly who wrote it originally, however, it did originally contain a menu titled "Cyber's Options" so full credit goes to whomever "Cyber" is. below is the code: #include <color.au3> #include <GUIConstants.au3> #include <GuiListView.au3> #include "DragControls.au3" #include <File.au3> #include <Misc.au3> #include <Array.au3> Opt( "ColorMode", 1 ) Global $controlini, $i Dim $captionexe[100][2] $controlcount = 0 $bgcolor = 0x004400 $configini = @ScriptDir&"\shell.ini" $title = "Zendows 1.1" $main = GUICreate($title, @DesktopWidth+2, @DesktopHeight+2,-2, -2, BitOR($WS_POPUP,$WS_SYSMENU), 0x00000080) $wingui = 0;GUICreate("Windows", 200, 200, 100, 100, $WS_SYSMENU, -1, $main) GUISwitch( $main ) ;GUISet UISetBkColor( $bgcolor ) $n=GUICtrlCreatePic(@ScriptDir & "\Image.jpg",500 ,500, 200, 200) GUISetState () ; resize the control $n=GUICtrlSetPos($n, 975,0,50,50) ;Menus $menu_controls = GUICtrlCreateMenu("Controls") $menu_system = GUICtrlCreateMenu("System") $menu_shutdown = GUICtrlCreateMenu("Shutdown") $menu_options = GUICtrlCreateMenu("Zendows Options") ;Shutdown' menu items $menu_standby = GUICtrlCreateMenuitem("Standby", $menu_shutdown) $menu_turnoff = GUICtrlCreateMenuitem("Turn Off", $menu_shutdown) $menu_restart = GUICtrlCreateMenuitem("Restart", $menu_shutdown) $menu_logoff = GUICtrlCreateMenuitem("Log Off", $menu_shutdown) ;Cybers' menu items $menu_showmenu = GUICtrlCreateMenuitem("Hide Top Menu", $menu_options) $menu_transparency = GUICtrlCreateMenuitem("Set Transparency", $menu_options) $menu_background = GUICtrlCreateMenu ("Set Background Color",$menu_options) $menu_default = GUICtrlCreateMenuitem("Set Default Shell", $menu_options) $menu_exit = GUICtrlCreateMenuitem("Exit", $menu_options) guictrlcreatemenuitem("Red", $menu_background) guictrlcreatemenuitem("Orange", $menu_background) guictrlcreatemenuitem("Yellow", $menu_background) $green = guictrlcreatemenuitem("Green", $menu_background) guictrlcreatemenuitem("Blue", $menu_background) guictrlcreatemenuitem("Black", $menu_background) guictrlcreatemenuitem("Purple", $menu_background) ;Controls' menu items $menu_create = GUICtrlCreateMenuitem("Create Control", $menu_controls) $menu_remove = GUICtrlCreateMenuitem("Remove Control", $menu_controls) $menu_color = GUICtrlCreateMenuitem("Color Control", $menu_controls) $menu_size = GUICtrlCreateMenuitem("Size Control", $menu_controls) GUICtrlCreateMenuitem("", $menu_controls) $menu_drag = GUICtrlCreateMenuitem("Drag Control(s)", $menu_controls) $menu_grid = GUICtrlCreateMenuitem("Show Grid", $menu_controls) $menu_snap = GUICtrlCreateMenuitem("Snap to Grid", $menu_controls) ;System menu' items $menu_taskman = GUICtrlCreateMenuitem("Task Manager", $menu_system) ;Undraggable controls $button = GUICtrlCreateButton( 'Welcome to Zendows 1.1', 23, 23, 150, 30 ) ;Drag overlay $overlay = _CreateDragControls() ;Draggable controls $controlini = IniReadSectionNames( $configini ) For $i = 1 To UBound($controlini)-1 If $controlini[$i] = "settings" Then ContinueLoop ConsoleWrite($controlini[$i]&@CRLF) $caption = IniRead($configini,$controlini[$i], "caption", -1) $type = IniRead($configini,$controlini[$i], "type", -1) $left = IniRead($configini,$controlini[$i], "left", -1) $top = IniRead($configini,$controlini[$i], "top", -1) $width = IniRead($configini,$controlini[$i], "width", -1) $height = IniRead($configini,$controlini[$i], "height", -1) If $caption=-1 Or $type=-1 Or $left=-1 Or $top=-1 Or $width=-1 Or $height=-1 Then MsgBox(0, $title, "Error loading control from ini") ContinueLoop Else _Createcontrol($caption, $type, $left, $top, $width, $height) EndIf Next IniWrite( $configini, "Settings", "Transparency", IniRead( $configini, "Settings", "Transparency", 255 )) WinSetTrans($main, "", IniRead( $configini, "Settings", "Transparency", 255 )) IniWrite( $configini, "Settings", "Bkcolor", IniRead( $configini, "Settings", "Bkcolor", 0x555555 )) GUISetBkColor(IniRead( $configini, "Settings", "Bkcolor", 0x555555 )) GUISetState() GUISetState(@SW_SHOW, $wingui) WinSetState( "[Class:Shell_TrayWnd]", "", @SW_HIDE ) $wintitle = WinGetTitle( $wingui ) AdlibEnable("updatewins", 10000) updatewins() While 1 $activewindow = WinGetTitle( "" ) $msg = GUIGetMsg(1) Select Case $msg[0] = $green GUICtrlSetBkColor ($green, 0x00ff00) Case $msg[0] = $GUI_EVENT_CLOSE Exit Case $msg[0] = $menu_exit Exit Case $msg[0] = $menu_transparency selecttransparency() Case $msg[0] = $menu_taskman Run("taskmgr") Case $msg[0] = $menu_default setdefault() Case $msg[0] = $menu_drag If BitAND(GUICtrlRead($menu_drag), $GUI_CHECKED) Then GUICtrlSetState($menu_drag, $GUI_UNCHECKED) _ShowGrid(False) _GridSnap(False) WinSetTitle( $wingui, "", $wintitle ) GUISetState( @SW_ENABLE, $wingui ) Else GUICtrlSetState($menu_drag, $GUI_CHECKED) GUISetState( @SW_DISABLE, $wingui ) WinSetTitle( $wingui, "", $wintitle & " - Disabled" ) _ShowGrid() _GridSnap() EndIf Case $msg[0] = $menu_showmenu If BitAND(GUICtrlRead($menu_showmenu), $GUI_CHECKED) Then GUICtrlSetState($menu_showmenu, $GUI_UNCHECKED) WinMove( $main, "", -2, -2, @DesktopWidth+2, @DesktopHeight+2, 60 ) Else GUICtrlSetState($menu_showmenu, $GUI_CHECKED) WinMove( $main, "", -2, -18, @DesktopWidth+2, @DesktopHeight+18, 60 ) EndIf Case $msg[0] = $overlay And BitAND(GUICtrlRead($menu_drag), $GUI_CHECKED) _InitDrag($main, $overlay) Case BitAND(GUICtrlRead($menu_drag), $GUI_CHECKED) $gui = GUISwitch( $main ) _DragItem($main, $overlay, True) GUISwitch($gui) EndSelect WEnd Func setdefault() If Not @Compiled Then MsgBox( 0, $title, "Please Compile first will all the local files extracted" ) Return If IniRead( @ProgramFilesDir&"\Cyber's Shell\config.ini", "Init", "Set Shell", "No" ) Then If MsgBox( 36, $title, "Would you like to set Cyber's Shell as your default shell?"&@CRLF&"You will be able to change this from the shell" ) = 7 Then FileCopy( @ScriptDir&"\"&@ScriptName, @ProgramFilesDir&"\Cyber's Shell\"&@ScriptName, 9 ) IniWrite( @ProgramFilesDir&"\Cyber's Shell\config.ini", "Init", "Set Shell", "Yes" ) ;Regwrite("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "Shell", "REG_SZ", @ProgramFilesDir&"\Cyber's Shell\"&@ScriptName) Else ;RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "Shell") IniWrite( @ProgramFilesDir&"\Cyber's Shell\config.ini", "Init", "Set Shell", "Yes" ) EndIf EndIf EndIf EndFunc Func selecttransparency() $i = Int(InputBox( $title, "Enter a number in the range 40 - 255. The lower the number, the more transparent the window will become. 255 = Solid, 0 = Invisible.", 100 )) If $i > 39 And 256 > $i Then WinSetTrans($main, "", $i) IniWrite($configini, "Settings", "Transparency", $i) WinSetTrans($main, "", $i) EndIf EndFunc Func selectbgcolor() $i = _ChooseColor(1) If Not @error Then GUISetBkColor( $i ) IniWrite($configini, "Settings", "Bkcolor", $i) EndIf EndFunc Func _Createcontrol($caption, $type, $left, $top, $width, $height) Switch $type Case "button" Return GUICtrlCreateButton( "Loading", $left, $top, $width, $height ) Case "label" Return GUICtrlCreateLabel( "Loading", $left, $top, $width, $height ) EndSwitch $tempfile = _TempFile( @TempDir, "ctrl_cap_", ".au3" ) $captionexe[$controlcount][0] = $tempfile $captionexe[$controlcount][1] = IniRead( $configini, $controlini[$i], "caption", "$return = 'Error, missing caption script'" ) FileWrite( $tempfile, $captionexe[$controlcount][1] & @CRLF & 'FileWrite( "return"&$tempfile, $return )' ) $controlcount = $controlcount + 1 EndFunc Func _ProcessListProperties($Process = "", $sComputer = ".");borrowed function Local $sUserName, $sMsg, $sUserDomain, $avProcs If $Process = "" Then $avProcs = ProcessList() Else $avProcs = ProcessList($Process) EndIf If $avProcs[0][0] = 0 Then Return $avProcs ReDim $avProcs[$avProcs[0][0] + 1][7] $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sComputer & "\root\cimv2") If IsObj($oWMI) Then $colProcs = $oWMI.ExecQuery ("select * from win32_process") If IsObj($colProcs) Then For $oProc In $colProcs For $n = 1 To $avProcs[0][0] If $avProcs[$n][1] = $oProc.ProcessId Then $avProcs[$n][2] = $oProc.ParentProcessId If $oProc.GetOwner ($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName $avProcs[$n][4] = $oProc.Priority $avProcs[$n][5] = $oProc.ExecutablePath ExitLoop EndIf Next Next Else SetError(2) EndIf $oRefresher = ObjCreate("WbemScripting.SWbemRefresher") $colProcs = $oRefresher.AddEnum ($oWMI, "Win32_PerfFormattedData_PerfProc_Process").objectSet $oRefresher.Refresh Sleep(1000) $oRefresher.Refresh For $oProc In $colProcs For $n = 1 To $avProcs[0][0] If $avProcs[$n][1] = $oProc.IDProcess Then $avProcs[$n][6] = $oProc.PercentProcessorTime ExitLoop EndIf Next Next Else SetError(1) EndIf Return $avProcs EndFunc Func _ProcessGetPath($iPid) $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") if IsObj($oWMI) Then $colProcs = $oWMI.ExecQuery ("select * from win32_process") if IsObj($colProcs) Then For $oProc In $colProcs if $oProc.ProcessId == $iPid Then return $oProc.ExecutablePath EndIf Next EndIf EndIf return "" EndFunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Func IconButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $BIconNum, $BIDLL = "shell32.dll") GUICtrlCreateIcon($BIDLL, $BIconNum, $BIleft + 5, $BItop + (($BIheight - 16) / 2), 16, 16) GUICtrlSetState( -1, $GUI_DISABLE) $XS_btnx = GUICtrlCreateButton($BItext, $BIleft, $BItop, $BIwidth, $BIheight, $WS_CLIPSIBLINGS) Return $XS_btnx EndFunc Func onautoitexit() WinSetState( "[Class:Shell_TrayWnd]", "", @SW_SHOW ) EndFunc Func updatewins();;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;TASKBAR $wins = WinList() GUISwitch($wingui) $x=1 $y=1 For $i = 0 To UBound($wins)-1 If $wins[$i][0] <> "" AND IsVisible($wins[$i][1]) Then $pid = WinGetProcess( $wins[$i][0] ) $path = _ProcessGetPath($pid) ConsoleWrite($path&@CRLF) IconButton($wins[$i][0], $x, $y, -1, -1, -1, $path) EndIf Next ConsoleWrite(@CRLF) GUISwitch($main) Return EndFunc ^ end of the code Thanks again Education: Francis Tuttle Technology Center adult full-time studentCourse of study: Network TechnologyCurrent Course: Microsoft Windows Server 2003, Enterprise EditionCompleted Courses: CompTIA A+ Hardware and Software, Windows XP Professional, Microsoft Office 2003, Desktop Support and Troubleshooting, and CompTIA Network+Remaining Courses: Linux Administration, Copper Cabling, Microsoft Windows Server 2003, Enterprise EditionAchievements: @17 years old, scored 98th percentile U.S. in Algebra 2 and Advanced Chemistry. [i.e. Ranked top 2% in the nation of High School students] 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