Jump to content
Sign in to follow this  

Color Select Example

Recommended Posts

These are 2 useful examples on how to change the color of a GUI background.

They are made by a user named ReaperX from another forum, not Autoit

and i didn't ask his permission. Can't tell the forum, maybe it breaks this forums rules.

1) A Sample GUI. It Just Uses 3 Radio Buttons and You Choose One to Change the GUI BG Color to.

include <GUIConstants.au3>
Func MainGUI()
    GUICreate("ReaperX's Test GUI")
    $file = GUICtrlCreateMenu("File")
    $file_notepad = GUICtrlCreateMenuItem("Open Notepad", $file)
    $file_computer = GUICtrlCreateMenuItem("Open My Computer", $file)
    $file_exit = GUICtrlCreateMenuItem("Exit", $file)
    $actions = GUICtrlCreateMenu("Actions")
    $actions_txt_file = GUICtrlCreateMenuItem("Open Text File", $actions)
    $actions_calc = GUICtrlCreateMenuItem("Open Calculator", $actions)
    $help = GUICtrlCreateMenu("Help")
    $help_about = GUICtrlCreateMenuItem("About", $help)
    $tab_set = GUICtrlCreateTab(110, 100, 135, 150)
    $tab_1 = GUICtrlCreateTabItem("Change BG")
    $bg_red_radio = GUICtrlCreateRadio("Red", 115, 125)
    $bg_green_radio = GUICtrlCreateRadio("Green", 115, 145)
    $bg_yellow_radio = GUICtrlCreateRadio("Yellow", 115, 165)
    $tab_2 = GUICtrlCreateTabItem("AutoIt Info")
    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        If $msg = $file_notepad Then
             $file = Run("notepad.exe")
        if $msg = $file_computer Then
             $file = Run("explorer.exe")
        If $msg = $file_exit Then
        If $msg = $actions_txt_file Then
            $txt_file_1 = FileOpenDialog("Choose a Text File to Open...", @DesktopDir, "Text Files(*.txt)")
        If $msg = $actions_calc Then
        If $msg = $help_about Then
            $help = MsgBox(0, "About", "This Test GUI Was Created by ReaperX")
        Case $msg = $bg_red_radio
        Case $msg = $bg_green_radio
        Case $msg = $bg_yellow_radio

2) Brings up a Color Pallette in the GUI and You Use it To Select a Color to Change the BG of the GUI to.

#Include <GUIConstants.au3>
#Include <Misc.au3>
GUICreate("Choose Color")
$button = GUICtrlCreateButton("Choose Color", 150, 150)
$iReturnType = 2
While 1
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE Then Exit
        Case $msg = $button
            $color = _ChooseColor($iReturnType)

[font="verdana, geneva, sans-serif"] [/font]

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Schuster
      Hey there,
      i need your help guys. I am working in the QA department of my company. A little part of or software produces hints (like little popups) which needs to be tested every release. I wrote scripts to trigger those hints and i also implemented the imagesearch.dll to find those hints on the screen. My goal now is it to let the machine work over night, so when i come back to work i only get a report which says 130/140 hints were found successfully. This already works, aslong as my pc is not locked, but i want/need to lock my pc because of security concerns.
      My general question. Is it possible to run my scripts on my locked PC and still find an image that i provide which will open sooner or later in the background?
      Thanks in advance
    • By nooneclose
      Good morning, I have been thinking about trying to make my Autoit script run in the background. I found out today that it is impossible due to the UIA and mouseclick functions that I use. However, while reading other posts about running Autoit scripts in the background I saw a reply mentioning how a script like mine might be able to run on a VM while still giving me the ability to work on my Host OS. Can someone confirm this? 
      Here is a link to the thread where I saw VM mentioned. 
      the person who mentioned it was @ViciousXUSMC 
    • By b9k
      Hi, I am stuck on a GUI problem and would like your help to solve it.
      I am trying to automate the SoundWire Server app to match my current system volume level while it is minimized to the notification area (so no clicking or stealing focus),
      I can already get the handle and alter the tracker position by sending a WM_SETPOS message, but somehow the actual volume is not changed: I think I need to do something else to trigger the event handler for the value change and propagate it correctly.
      This is the control summary from Au3 info:
      >>>> Window <<<< Title: SoundWire Server Class: #32770 Position: 441, 218 Size: 566, 429 Style: 0x94CA00C4 ExStyle: 0x00050101 Handle: 0x0000000000510E12 >>>> Control <<<< Class: msctls_trackbar32 Instance: 4 ClassnameNN: msctls_trackbar324 Name: Advanced (Class): [CLASS:msctls_trackbar32; INSTANCE:4] ID: 6002 Text: Position: 51, 222 Size: 47, 126 ControlClick Coords: 1, 101 Style: 0x5001000A ExStyle: 0x00000000 Handle: 0x00000000001234C8 >>>> Mouse <<<< Position: 496, 567 Cursor ID: 2 Color: 0xF0F0F0 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Default multimedia device Tray on Start Static Server Address: Status: Connected to B9K~OP3 Audio Output Audio Input Level Record to File Input Select: 44.1 kHz Minimize to Master Volume Mute >>>> Hidden Text <<<< Slider2 Mute OK Cancel Label Balance Slider1 Volume Front L/R Fr C/LFE Side L/R Back L/R
      I am attaching the program in question so you don't have to install it (i don't know if it is portable enough, tough): 

      SoundWire Server_files.zip

      Thanks in advance and I hope I didn't post in the wrong section
    • By lenclstr746
      I'm a work on a background see and click bot project 
      I can complete it if your help me
      (using imagesearch , gdi+ and  fastfind)
    • By ur
      When we run our exe from any service or through any background process, it won't interact with the applications running in the foreground, I mean launched when the user is logged in or in GUI mode.
      Let's say, the onedrive sync app can't be detected from the exe we created and running it in background.

      I tried both options below.

      Any Idea how to interact with foreground processes using AuotIT code.

      Other than telling to launch the exe also in foreground.
  • Create New...