AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Color Buttons

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
noonz78



Joined: 22 Jul 2007
Posts: 2
Location: Texas

PostPosted: Sun Jul 22, 2007 7:42 pm    Post subject: Color Buttons Reply with quote

Hello,

I have gained so much from this community and I wish to contribute a bit. I wasn't able to find any methods for creating color buttons so far and decided to develop my own. Color association helps my ADD butt stay on task and remember better.

Method:
1. Create button menu1
2. Make menu1 slightly transparent
3. Make menu2 with background, same cooridinate, dimentions etc...
4. Add 100% color progress bars at each of the button cooridinates.

I was working on a loop method for shrinking the code and making it more agile. I wanted you to be able to specify all the button names, colors and dimentions in one location and have everything else generated on the fly. However I've found no way of being able to use a loop variable to pull a defintions from outside the loop so far.

My colors tend to match the application the button will launch.
Here's my sample. I hope it works!

Code:

;General Window Settings
Gui, Font, s11 w700
Gui, -Caption +E0x200 +ToolWindow
TransColor = D4D1C8
Gui, Color, %TransColor%  ; This color will be made transparent later below.

bgColor = White ; Background color
;Button number, as found using the number pad
Seven = x10 y10 w100 h100 cWhite
Eight = x120 y10 w100 h100 cBlue
Nine = x230 y10 w100 h100 cRed
Four = x10 y120 w100 h100 c6698cb
Five = x120 y120 w100 h100 cFFC128
Six = x230 y120 w100 h100 c90D8EF
One = x10 y230 w100 h100 cf7f7e8
Two = x120 y230 w100 h100 c99cc99
Three = x230 y230 w100 h100 ceeee22

Gui, Add, Button, %Seven%, Drudge
Gui, Add, Button, %Eight%, MSNBC
Gui, Add, Button, %Nine%, Close
Gui, Add, Button, %Four%, MySpace
Gui, Add, Button, %Five%, YAHOO
Gui, Add, Button, %Six%, AutoHotKey
Gui, Add, Button, %One%, EHR
Gui, Add, Button, %Two%, WebPortal
Gui, Add, Button, %Three%, AD
Gui, Show, x400 y400 h340 w340

WinGet, k_ID, ID, A   ; Get its window ID.
WinSet, AlwaysOnTop, On, ahk_id %k_ID%
WinSet, TransColor, %TransColor% 170, ahk_id %k_ID%

Gui, 2:-Caption +E0x200 +ToolWindow
Gui, 2:Color, %bgColor% ; Set background color here

Gui, 2:Add, Progress, %Seven%, 100
Gui, 2:Add, Progress, %Eight%, 100
Gui, 2:Add, Progress, %Nine%, 100
Gui, 2:Add, Progress, %Four%, 100
Gui, 2:Add, Progress, %Five%, 100
Gui, 2:Add, Progress, %Six%, 100
Gui, 2:Add, Progress, %One%, 100
Gui, 2:Add, Progress, %Two%, 100
Gui, 2:Add, Progress, %Three%, 100
Gui, 2:Show, x400 y400 h340 w340
Return

ButtonClose:
ExitApp

ButtonAutoHotKey:
Run, http://www.autohotkey.com/
ExitApp

ButtonYahoo:
Run, http://www.yahoo.com/
ExitApp

ButtonMySpqace:
;Insert autologin code here
ExitApp

ButtonMSNBC:
Run, http://www.msnbc.com
ExitApp

ButtonDrudge:
Run, http://www.drudgereport.com
ExitApp

ButtonAD:
Run, mmc %systemroot%\system32\dsa.msc
WinWait, Active Directory Users and Computers, Active Directory Use
GoSub, LastFoundWindow
Send, {ALTDOWN}ai{ALTUP}
WinWait, Find Users`, Contacts`, and Groups, Select the storage f
GoSub, LastFoundWindow
Send, {SHIFTDOWN}{INS}{SHIFTUP}{ENTER}
Sleep 100
Send, {SPACE}{ALTDOWN}f{ALTUP}
Sleep 200
Send, r
ExitApp

LastFoundWindow: ;Duh
IfWinNotActive  ;automatically uses Last Found Window
    WinActivate  ;automatically uses Last Found Window
WinWaitActive  ;automatically uses Last Found Window
Return

StatusWaitDone: ; Used to wwait for a webpage to load before conintue
   SLEEP 100
   AHKID := WinExist("A")
   Ctr=0
   Loop
      {
      Sleep, 10
      Ctr+=1
      ControlGet, Progress, Visible,, msctls_progress321, ahk_id %AHKID%
      If (Progress=1)
         {
         Ctr=0
         Continue
         }
      If (Progress=0 AND Ctr>10)
      Break
      }
      StatusBarWait, Done, 10
      RETURN
Back to top
View user's profile Send private message MSN Messenger
AutoGuest
Guest





PostPosted: Wed Jul 25, 2007 3:42 pm    Post subject: Reply with quote

Cool! Very Happy It works for me. Smile
P.S. I saw your trick...
Back to top
Conquer



Joined: 27 Jun 2006
Posts: 383
Location: Canada

PostPosted: Wed Jul 25, 2007 7:06 pm    Post subject: **** A! Reply with quote

Thanks! It's been asked for. Now I can make ubar cool looking black & lime GUI's Twisted Evil

Quote:
P.S. I saw your trick...

Trick! Where! Rawr.

EDIT: Oh! Clever. I see it now. Progresses! Thats quite the genius idea.

Is there any way to have more direct control? Like straight Black background (0 Transparency) and a Lime over text?

After a little research in your code, I think that the transparency is required for the colour effect you're using? I've noticed dragging a window such as notepad over the buttons removes its colour..
_________________
Back to top
View user's profile Send private message
WankaUSR



Joined: 14 Aug 2007
Posts: 17

PostPosted: Wed Apr 30, 2008 8:37 am    Post subject: Reply with quote

ok either i'm dump or can seem to make thiss work in my gui Sad
Code:
btnHelp = x6 y609 w90 h20 ghelp cEFEFEF
Gui, Add, Button, %btnHelp%, Help
Gui, Add, Button, x116 y609 w90 h20  , Exit
Gui, Add, Button, x6 y579 w90 h20  , Update list
Gui, Add, Button, x116 y579 w90 h20 , Stop play
Gui, Show,h640 w214,GUI

please help
Back to top
View user's profile Send private message
noonz78



Joined: 22 Jul 2007
Posts: 2
Location: Texas

PostPosted: Tue May 13, 2008 10:50 pm    Post subject: Reply with quote

I added labels for your buttons to to find and took out the ghelp in your setting of "btnHelp". Sorry I'm in a bit of a rush right now. I actually prefer to use HTA's for my gui's now.

Code:

btnHelp = x6 y609 w90 h20 cEFEFEF
Gui, Add, Button, %btnHelp%, Help
Gui, Add, Button, x116 y609 w90 h20  , Exit
Gui, Add, Button, x6 y579 w90 h20  , Update list
Gui, Add, Button, x116 y579 w90 h20 , Stop play
Gui, Show,h640 w214, gui
Return

ButtonHelp:
ExitApp

ButtonExit:
ExitApp

ButtonUpdate_list:
ExitApp

ButtonStop_play:
ExitApp
Back to top
View user's profile Send private message MSN Messenger
Fry



Joined: 01 Nov 2007
Posts: 533

PostPosted: Sun May 18, 2008 5:14 am    Post subject: Reply with quote

How does this work at all?

I can't seem to get i to work
_________________
check out my site
www.eliteknifesquad.com

Back to top
View user's profile Send private message
WankaUSR



Joined: 14 Aug 2007
Posts: 17

PostPosted: Wed May 28, 2008 8:02 pm    Post subject: Reply with quote

That did not work eighter ....
Actually you example works but when I try something like taht the button remain as standard.
Could it be because of the windows theme??
Back to top
View user's profile Send private message
Gosugenji



Joined: 07 May 2008
Posts: 35
Location: In your Internets

PostPosted: Fri May 30, 2008 10:26 pm    Post subject: Reply with quote

It uses a mostly clear window overlay over the color progresses.
Clear window is always on top,
Colors are behind and can be hidden via opening a maximized window such as firefox.
I can see the demo @ desktop level.
Back to top
View user's profile Send private message
flytox
Guest





PostPosted: Sun Jun 01, 2008 11:39 pm    Post subject: select color Reply with quote

great. i use your idea like that:

Code:
Gui, Add, Button, x10 y10 w100 h50 gClick, Click
Gui, Show, x200 y400 h70 w120
Return

Click:
If Altern
   {
   Gui, 2:Color, red
   Gui, 2:Add, Text,x38 y18 , Click
   Gui, 2:Show, x213 y432 w93 h24
   WinSet, AlwaysOnTop, On, ahk_class AutoHotkeyGUI
   WinSet, TransColor, DDDDDD 170, ahk_class AutoHotkeyGUI
   Gui, 2: -caption
   Gui, 2:Add, Progress, x0 y0 w100 h50 cred, 100
   }
return

~LButton::
MouseGetPos, MouseX, MouseY

if (MouseX > 15 and MouseX < 110 and MouseY > 35 and MouseY < 78)
   {
   Altern:= !Altern
   If !Altern
      Gui, 2:Destroy
   }
return
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group