Jump to content

Recommended Posts

Good evening, I need to configure a graphical interface where the contents of some "Button" are taken from a file I have foreseen to include with "#include".
For the text no problem, the problem comes when I'm going to assign the color to the background of the "Button", the "Button" becomes BLACK WHITE.
I included in the included file as follows:

$ Promotion_Color = "$ Color_Red"

Clarity I also imported #include the library <ColorConstants.au3>

In the main program I wrote like this:

$ Promotion = GUICtrlCreateButton ($ Promotion, Dim_Fin_X + $ 170, $ Dim_Fin_Y, 750.120)
GUICtrlSetFont (-1, 70, 800, 0, "Calibri")
GUICtrlSetBkColor ($ Promotion, $ Promotion_Color); will change background color

I thank all those who want to help me

Alberto

Edited by trescon

Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Link to post
Share on other sites

Hi.

I guess your problem above is because the quotation marks. Try:

$Promotion_Color = $Color_Red

By the way in your code above you have spaces between the $ and the rest of the variable.

This is not correct: $ Promotion_Color = 

This is correct: $Promotion_Color = 

Conrad

Edited by Simpel
SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to post
Share on other sites
1 hour ago, Simpel said:

Hi.

I guess your problem above is because the quotation marks. Try:

$Promotion_Color = $Color_Red

By the way in your code above you have spaces between the $ and the rest of the variable.

This is not correct: $ Promotion_Color = 

This is correct: $Promotion_Color = 

Conrad

Space has put it google during translation, in real code there is no.

Thanks anyway

Thank You

Alberto

---------------------------------------------------

I am translate with Google.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By hendrikhe
      Hello,
      I am trying to create a small tool which alerts me when I receive a message from Skype for Business.
      You know sometimes you simple miss a conversation...
      I need to know when the message windows pops up:
       
      If message window active Then
      play a very loud sound
      EndIF
       
      Usually I would use WinActive() function, however it requires a title. And this doenst work, because the title is the name of the person 
      messaging me, and can change every time.
      Is it possible to check if a Class "LyncTabFrameHostWindowClass" is active?
       

       
       
       
    • By rcmaehl
      Hi all,

      I'm encountering a weird issue. I'm attempting to toggle off Caps Lock and it briefly turns it off before it just turns right back on causing the LED to just strobe constantly. I'm using the following code:
      Opt("WinTitleMatchMode", 2) Global Const $VK_CAPITAL = 0x14 Main() Func _GetCapsLock() Local $ret $ret = DllCall("user32.dll","long","GetKeyState","long", $VK_CAPITAL) Return $ret[0] EndFunc Func Main() While 1 If _GetCapsLock() And WinActive("Chrome") Then Send("{CAPSLOCK OFF}") WEnd EndFunc I've tried the following to no resolve:
      Using #RequireAdmin Using {CAPSLOCK TOGGLE} Setting "SendKeyDownDelay" to values other than 5 Adding Sleep after attempting to turn off CapsLock Using _WinAPI_GetAsyncKeyState($VK_CAPITAL) My working environment is:
      AutoIt 3.3.14.4, running as Standard user (Admin also attempted as noted) Running as a non-compiled script in SciTE Windows 7 Enterprise 7601 SP1 McAfee Enterprise I'm sure I'm forgetting something basic, so any help is appreciated.
    • By hotkidd
      Have this AutoIT script used to click a button in Web to export data to Excel. It works well when run it from command line or AutoIT compiled .exe.
      But after added it to a Win10 VM Task Scheduler as I need to run it daily, it fails to be executed.
      Steps to reproduce:
      1. Compile the script to .exe.
      2. Go to Task Scheduler. Create the task to run this .exe.
      3. Right click on the created task -> run  -> shows nothing.
       
      Snippet of the code:
      Local $URL = "URL" Local $title = "title" Local $name = "name" Local $oIE = _IECreate() _IEPropertySet($oIE, "toolbar", False ) _IEPropertySet($oIE, "height", 800 ) _IEPropertySet($oIE, "width", 1000 ) _IEPropertySet($oIE, "left", 0 ) _IEPropertySet($oIE, "top", 0 ) _IEPropertySet($oIE, "resizable", False ) _IENavigate($oIE, $URL) Sleep(5000) _IENavigate($oIE, $ReportWeb) Sleep(10000) ;click the button to export the Excel and save it ControlClick($titleName, $textName, "[CLASS:Internet Explorer_Server; INSTANCE:1]","main",1,100,100) ControlSend($title,$name,"[CLASS:DirectUIHWND; INSTANCE:1]","{ENTER}")
    • By Skysnake
      $item = GUICtrlCreateListViewItem("", $ListVw) ; create ListViewItems empty cells GUICtrlSetBkColor($item, $Clr) ; Set the background color for the listview item ; loop the result array $hist = $r0 & "|" & $r1 & "|" & $r2 & "|" & $r3 & "|" & $r4 GUICtrlSetData($item, $hist) ; set the ListView values I can color rows.  What I want to achieve is to consistently color column 3, creating a column with the same colour.
      I am looking for an EASY way to do this.  I have seen examples that can color each individual cell, but it requires 1000's of lines of code.  
       
      The ideal solution would be something like GuiCtrlSetListViewItemBkColor()
      Any ideas please?
    • By User71
      Hi All,
      I'm sure this is a simple one to answer and I have searched and experimented before I asked (well enough hopefully!)
      I'm trying to set a button background to be white, the font colour red, centred vertically and horizontally and multi-line. Can it be done?
      Here is my example code:
      #include <Constants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ColorConstantS.au3> #include <FontConstants.au3> #include "ColorConstants.au3" Opt("GUIOnEventMode", 1) $GUI = GUICreate("GUI", 250, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Button = GUICtrlCreateButton("Button" & @CRLF & "One", 160, 185, 85, 110, BitOR($BS_MULTILINE, $BS_CENTER, $BS_VCENTER, $WS_EX_WINDOWEDGE)) GUICtrlSetBkColor(-1, $COLOR_White) GUICtrlSetFont($Button, 14, 800, 0, "MV Boli", 5) GUICtrlSetColor($Button, 0xFF0000) GUICtrlSetOnEvent($Button, "_Exit") GUISetState() While 1 Sleep(100) WEnd Func _Exit() Exit EndFunc ;==>_ExitWith everything I have tried, this is the closest I get, button white, font red, correct font, but no centring and sometimes no multi-line (depending on button text and font size). I saw I might have to add the default button forced style back in so I did that too $WS_EX_WindowEdge.
      Thanks for any help and apologies if I've missed an obvious answer to this elsewhere.
×
×
  • Create New...