ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: Across-the-room Stability Monitor

<< < (4/5) > >>

mouser:
looks cool!

jgpaiva:
Welcome LuckMan to the coding snacks coder's group  :tellme:
SysBeacon looks good!
Congratulations on your first ahk script :D
Hope to see more of those soon  :Thmbsup:
Just one proposition: why don't you post the source?

LuckMan212:
ok yes, here is the source as you requested:
keep in mind this will not really run correctly as an .ahk script without some modification, due to some custom things I am doing with PIDs and icons... but it could be easily tweaked to work again as a raw ahk script...
 ;)

--- ---;SysBeacon
; blinks at intervals to inform user that system is alive!
; v1.01 ©2006 LuckMan212, portions inspired by jgpaiva and skrommel of DonationCoder.com

#SingleInstance,Force
#NoTrayIcon
AutoTrim,Off
OnExit,SaveAndQuit

hdc:=DllCall("GetDC")
bpp:=DllCall("GetDeviceCaps", "Int", hdc, "Int", 12)
if bpp<32
{
  t_icon=7
  m_icon=Icon3
}
else
{
  t_icon=6
  m_icon=Icon1
}
appname=SysBeacon
inifile=%appname%.ini
myname=%A_ScriptName%
Process,Exist
mypid=%ErrorLevel%
if mypid=
  MsgBox,Error getting PID!

IfNotExist,%inifile%
{
  firstrun=true
  FileAppend,,%inifile%
  If ErrorLevel
    MsgBox, Error creating ini file!
}
IniRead,x,%inifile%,Settings,x,0
IniRead,y,%inifile%,Settings,y,0
IniRead,w,%inifile%,Settings,w,127
IniRead,h,%inifile%,Settings,h,127
IniRead,blinkinterval,%inifile%,Settings,blinkinterval,500
IniRead,color1,%inifile%,Settings,color1,000000
IniRead,color2,%inifile%,Settings,color2,00FF00
IniRead,aot,%inifile%,Settings,alwaysontop,1
;sanity checks
if x=
  x=0
if y=
  y=0
if w=
  w=127
if h=
  h=127
if blinkinterval=
  blinkinterval=500
if color1=
  color1=000000
if color2=
  color2=00FF00
if aot=
  aot=1

Gosub,TRAYMENU
Gosub,UPDATE_AOT
EnvSub,w,8
EnvSub,h,26
Gui,+Resize +ToolWindow
Gui,Color,%color1%
Gui,Show,x%x% y%y% w%w% h%h%,%appname%
Gosub SAVE_INI
SetTimer,CHANGE,%blinkinterval%
Return

CHANGE:
If color=%color2%
  color=%color1%
Else
  color=%color2%
Gui,Color,%color%
Return

TRAYMENU:
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,&About...,ABOUT
Menu,Tray,Add,Always On Top,TOGGLE_ONTOP
Menu,Tray,Add,
Menu,Tray,Add,&Quit,SaveAndQuit
Menu,Tray,Tip,%appname%
Menu,Tray,Icon,%A_ScriptFullPath%,%t_icon%
Menu,Tray,Icon
if firstrun=true
{
  TrayTip,Welcome to %appname%!,Right click on this menu for basic options.`nAdvanced users can access more settings by`ndirectly editing the .ini file.  Good luck testing!,5,1
}
Return

ABOUT:
Gui,2:Destroy
Gui,2:-SysMenu
Gui,2:Add,Picture,x+295 ym+3 GSND_WIDGET %m_icon%,%myname%
Gui,2:Font,s10 Bold,Tahoma
Gui,2:Add,Text,xm ym+3,%appname% v1.01
Gui,2:Font,s8 Norm,Tahoma
Gui,2:Add,Text,xm y+1,Blinks to let you know your machine hasn't frozen!
Gui,2:Add,Text,xm y+1,Some settings can be adjusted by editing the .ini file.
Gui,2:Add,Text,xm y+15,Thanks to jgpaiva and skrommel for their code samples.
Gui,2:Add,Text,xm y+1,Visit
Gui,2:Font,s8 CBlue Norm,Tahoma
Gui,2:Add,Text,x+3 GWWW1,donationcoder.com
Gui,2:Font,s8 CBlack Norm,Tahoma
Gui,2:Add,Text,x+3,- the best software community on the web!
Gui,2:Add,Text,xm y+15,coded by
Gui,2:Font,Bold,Tahoma
Gui,2:Add,Text,x+3,LuckMan212
Gui,2:Font,s8 CBlue Norm,Tahoma
Gui,2:Add,Text,xm y+1 GWWW2,xtremesystems.org
Gui,2:Font,s8 Norm,Tahoma
Gui,2:Add,Button,GABOUTOK Default xm+125 yp+17 w75,&OK
Gui,2:Show,,About
Return

WWW1:
Run,https://www.donationcoder.com,,UseErrorLevel
Return

WWW2:
Run,http://www.xtremesystems.org/forums/member.php?u=6536,,UseErrorLevel
Return

SND_WIDGET:
SoundPlay,%SystemRoot%\Media\Windows XP Pop-up Blocked.wav
Return

ABOUTOK:
Gui,2:Destroy
Return

TOGGLE_ONTOP:
aot := !aot
Gosub UPDATE_AOT
Return

UPDATE_AOT:
If aot=1
{
  Menu,Tray,Check,Always On Top
  Gui,+AlwaysOnTop
}
Else
{
  Menu,Tray,UnCheck,Always On Top
  Gui,-AlwaysOnTop
}
Return

SAVE_INI:
WinGetPos,x,y,w,h,%appname% ahk_pid %mypid%
IfNotExist,%inifile%
{
  FileAppend,,%inifile%
  If ErrorLevel
    MsgBox, Error creating ini file!
}
IniWrite,%x%,%inifile%,Settings,x
IniWrite,%y%,%inifile%,Settings,y
IniWrite,%w%,%inifile%,Settings,w
IniWrite,%h%,%inifile%,Settings,h
IniWrite,%blinkinterval%,%inifile%,Settings,blinkinterval
IniWrite,%color1%,%inifile%,Settings,color1
IniWrite,%color2%,%inifile%,Settings,color2
IniWrite,%aot%,%inifile%,Settings,alwaysontop
If ErrorLevel
    MsgBox, Error saving settings to ini file!
Return

GuiClose:
ExitApp

SaveAndQuit:
Gosub SAVE_INI
ExitApp

jgpaiva:
Well.. I'll just try to learn something from your code.
Tell me, why do you do those dll calls?

LuckMan212:
this external DLL call is to determine the monitor depth (32 bit, 8 bit etc).  If the system cannot display the 32bit icons embedded in the .exe, then it falls back on some 8bit ones.  I was just experimenting with this type of thing, and got that tip from the AHK forums.  There doesn't seem to be a way to determine monitor depth directly using AHK.

you can test this by setting your monitor to 8 bit and re-launching the app... you will see a different tray icon (at least you should!)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version