; ; AutoHotkey Version: 1.x ; Language: English ; Platform: WinNT ; Author: David Earls ; ; Script Function: ; Ghost inactive Windows like XFCE ; ; Attribution: The code to loop through windows was paraphrased from the AHK forums. ; script of Unambiguous adjusted for use with PSPad #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. SetTitleMatchMode, 2 #SingleInstance, force DetectHiddenWindows, Off iniread, TransLvl, fadetoblack.ini, Preferences, Transparent, 150 iniread, delay, fadetoblack.ini, Preferences, Delay, 0 menu, tray, icon, %A_Windir%\System32\accessibilitycpl.dll, 15 menu, tray, nostandard menu, tray, add, &Configure, Configure menu, tray, default, &Configure menu, tray, add menu, tray, add, E&xit, ExitRoutine menu, tray, tip, Fades Inactive Windows - Please exit properly. OnExit, ExitRoutine #Persistent SetTimer, CheckIfActive, 1000 return CheckIfActive: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% WinGet, Trans, Transparent, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ;Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd ;Look down continue if class = Button ;Start Menu continue ; if active task, Set vis. IfWinActive, ahk_id %id_trans% { winset, Transparent, Off, ahk_id %id_trans% continue } If Trans = %TransLvl% ; already Transparent continue if delay { if wininactive%ID_trans% < %delay% wininactive%ID_trans% += 1 else { Winset,Transparent, %TransLvl%, ahk_id %id_trans% wininactive%ID_min% = 0 } } else Winset,Transparent, %TransLvl%, ahk_id %id_trans% } return ExitRoutine: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ;Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd continue if class = Button ;you get a large square if you remove this. continue Winset,Transparent,off, ahk_id %id_trans% } ExitApp return Configure: gui, add, text,,Transparency: gui, add, text,,Ghost gui, add, slider,x+5 vTransSlider Range20-255 tooltip,%TransLvl% gui, add, text,x+5,HiDef gui, add, text,xm,`nInactivity Delay (Seconds): gui, add, text,,Zero gui, add, slider,x+5 tooltip vDelaySlider Range0-90, %delay% gui, add, text,x+5,Ninety gui, add, button,xm,&Save gui, show,,Configure return ;the gui buttonSave: gui, submit iniwrite, %TransSlider%, fadetoblack.ini, Preferences, Transparent iniwrite, %DelaySlider%, fadetoblack.ini, Preferences, Delay reload return GuiEscape: GuiClose: gui, destroy return return ;configure sub
Fade Inactive Windows
Started by
earlsd
, Apr 08 2011 10:39 PM
118 replies to this topic
Here's some code to fade your inactive windows like XFCE. I've used in on Win7:
#1
-
Posted 08 April 2011 - 10:39 PM
1. Can I use it with XP? 2. Does it work with AHK basic (classic)? 3. Does it work out-of-the-box? 4. Any mal-side-effects? Thanks!
#2
-
Posted 08 April 2011 - 11:01 PM
1. Can I use it with XP? 2. Does it work with AHK basic (classic)? 3. Does it work out-of-the-box? 4. Any mal-side-effects? Thanks!
1. Probably (Not Tested)
2. Yes, I write everything for that because of L's code bloat.
3. I hope so.
4. If you kill it instead of exiting with the menu it will leave transparent windows, other than that I don't know of anything. I'm guessing it would slow the system down slightly if you are a performance freak.
P.S. let me know if there is anything wrong, I might be able to fix it. This isn't my first program. :wink:
#3
-
Posted 08 April 2011 - 11:55 PM
I tested on my XP, and it promptly presented me with the following error message:
Error: Can't load icon. The current thread will exit.
-> menu, tray, icon, %A_Windir%\System32\accessibilitycpl.dll, 15
___________________
Доверяй, но проверяй
Error: Can't load icon. The current thread will exit.
-> menu, tray, icon, %A_Windir%\System32\accessibilitycpl.dll, 15
___________________
Доверяй, но проверяй
#4
-
Posted 09 April 2011 - 12:12 AM
I tested on my XP, and it promptly presented me with the following error message:
Error: Can't load icon. The current thread will exit.
-> menu, tray, icon, %A_Windir%\System32\accessibilitycpl.dll, 15
You can safely comment out that line or point it at your preferred icon. That file comes with Windows 7 and it's a little light bulb icon.
To comment it out just put a ; in front of it.
#5
-
Posted 09 April 2011 - 12:16 AM
Thanks! I commented another line (2 lines altogether), so I guess this should work on XP?
___________________
Доверяй, но проверяй
; http://www.autohotkey.com/forum/viewtopic.php?p=435226#435226 ; Fade Inactive Windows ; AutoHotkey Version: 1.x ; Language: English ; Platform: WinNT ; Author: David Earls ; ; Script Function: ; Ghost inactive Windows like XFCE ; ; Attribution: The code to loop through windows was paraphrased from the AHK forums. ; script of Unambiguous adjusted for use with PSPad #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. SetTitleMatchMode, 2 #SingleInstance, force DetectHiddenWindows, Off ; iniread, TransLvl, fadetoblack.ini, Preferences, Transparent, 150 iniread, delay, fadetoblack.ini, Preferences, Delay, 0 ; menu, tray, icon, %A_Windir%\System32\accessibilitycpl.dll, 15 menu, tray, nostandard menu, tray, add, &Configure, Configure menu, tray, default, &Configure menu, tray, add menu, tray, add, E&xit, ExitRoutine menu, tray, tip, Fades Inactive Windows - please exit properly OnExit, ExitRoutine #Persistent SetTimer, CheckIfActive, 1000 return CheckIfActive: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% WinGet, Trans, Transparent, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ; Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd ; Look down continue if class = Button ; Start Menu continue ; If active task, Set vis. IfWinActive, ahk_id %id_trans% { winset, Transparent, Off, ahk_id %id_trans% continue } If Trans = %TransLvl% ; Already Transparent continue if delay { if wininactive%ID_trans% < %delay% wininactive%ID_trans% += 1 else { Winset,Transparent, %TransLvl%, ahk_id %id_trans% wininactive%ID_min% = 0 } } else Winset,Transparent, %TransLvl%, ahk_id %id_trans% } return ExitRoutine: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ; Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd continue if class = Button ; You get a large square if you remove this! continue Winset,Transparent,off, ahk_id %id_trans% } ExitApp return Configure: gui, add, text,,Transparency: gui, add, text,,Ghost gui, add, slider,x+5 vTransSlider Range20-255 tooltip,%TransLvl% gui, add, text,x+5,HiDef gui, add, text,xm,`nInactivity Delay (Seconds): gui, add, text,,Zero gui, add, slider,x+5 tooltip vDelaySlider Range0-90, %delay% gui, add, text,x+5,Ninety gui, add, button,xm,&Save gui, show,,Configure return ; The GUI buttonSave: gui, submit iniwrite, %TransSlider%, fadetoblack.ini, Preferences, Transparent iniwrite, %DelaySlider%, fadetoblack.ini, Preferences, Delay reload return GuiEscape: GuiClose: gui, destroy return return ; Configure subPS: In my case, nothing seems to fade?
___________________
Доверяй, но проверяй
#6
-
Posted 09 April 2011 - 12:27 AM
; iniread, TransLvl, fadetoblack.ini, Preferences, Transparent, 150
The non-icon line you commented out is the one that sets the transparency level. If the INI file is not found it sets the variable to 150 so it should work with or without an ini. (Using the settings dialog creates the ini so you don't need to do it manually in any case.)
Was this line causing a problem for you? Or, I guess my question is why did you comment it out?
Also, for people wanting an actual fix for the icon issue it would be:
The non-icon line you commented out is the one that sets the transparency level. If the INI file is not found it sets the variable to 150 so it should work with or without an ini. (Using the settings dialog creates the ini so you don't need to do it manually in any case.)
Was this line causing a problem for you? Or, I guess my question is why did you comment it out?
Also, for people wanting an actual fix for the icon issue it would be:
ifexist, %A_Windir%\System32\accessibilitycpl.dll menu, tray, icon, %A_Windir%\System32\accessibilitycpl.dll, 15
#7
-
Posted 09 April 2011 - 01:51 AM
Indeed, that line was giving me an error message similar to the first line. Is there any way around this problem?
Доверяй, но проверяй
; http://www.autohotkey.com/forum/viewtopic.php?p=435226#435226 ; Fade Inactive Windows ; AutoHotkey Version: 1.x ; Language: English ; Platform: WinNT ; Author: David Earls ; ; Script Function: ; Ghost inactive Windows like XFCE ; ; Attribution: The code to loop through windows was paraphrased from the AHK forums. ; script of Unambiguous adjusted for use with PSPad #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. SetTitleMatchMode, 2 #SingleInstance, force DetectHiddenWindows, Off ; iniread, TransLvl, fadetoblack.ini, Preferences, Transparent, 150 iniread, delay, fadetoblack.ini, Preferences, Delay, 0 ifexist, %A_Windir%\System32\accessibilitycpl.dll menu, tray, icon, %A_Windir%\System32\accessibilitycpl.dll, 15 menu, tray, nostandard menu, tray, add, &Configure, Configure menu, tray, default, &Configure menu, tray, add menu, tray, add, E&xit, ExitRoutine menu, tray, tip, Fades Inactive Windows - please exit properly OnExit, ExitRoutine #Persistent SetTimer, CheckIfActive, 1000 return CheckIfActive: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% WinGet, Trans, Transparent, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ; Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd ; Look down continue if class = Button ; Start Menu continue ; If active task, Set vis. IfWinActive, ahk_id %id_trans% { winset, Transparent, Off, ahk_id %id_trans% continue } If Trans = %TransLvl% ; Already Transparent continue if delay { if wininactive%ID_trans% < %delay% wininactive%ID_trans% += 1 else { Winset,Transparent, %TransLvl%, ahk_id %id_trans% wininactive%ID_min% = 0 } } else Winset,Transparent, %TransLvl%, ahk_id %id_trans% } return ExitRoutine: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ; Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd continue if class = Button ; You get a large square if you remove this! continue Winset,Transparent,off, ahk_id %id_trans% } ExitApp return Configure: gui, add, text,,Transparency: gui, add, text,,Ghost gui, add, slider,x+5 vTransSlider Range20-255 tooltip,%TransLvl% gui, add, text,x+5,HiDef gui, add, text,xm,`nInactivity Delay (Seconds): gui, add, text,,Zero gui, add, slider,x+5 tooltip vDelaySlider Range0-90, %delay% gui, add, text,x+5,Ninety gui, add, button,xm,&Save gui, show,,Configure return ; The GUI buttonSave: gui, submit iniwrite, %TransSlider%, fadetoblack.ini, Preferences, Transparent iniwrite, %DelaySlider%, fadetoblack.ini, Preferences, Delay reload return GuiEscape: GuiClose: gui, destroy return return ; Configure sub___________________
Доверяй, но проверяй
#8
-
Posted 09 April 2011 - 01:56 AM
There's really no way that particular line should be causing a problem unless something got corrupted when I posted to the forum. Try this link:
https://docs.google.... ... y=CNaz1dkE
Failing that try:
Below the iniread or just leave it commented out and insert your preferred transparency level somewhere in the format: translvl=150 If you do that the slider in the dialog will no longer effect the transparency level.
Sorry you're having so much trouble, but the iniread really should work.
https://docs.google.... ... y=CNaz1dkE
Failing that try:
if errorlevel translvl=150
Below the iniread or just leave it commented out and insert your preferred transparency level somewhere in the format: translvl=150 If you do that the slider in the dialog will no longer effect the transparency level.
Sorry you're having so much trouble, but the iniread really should work.
#9
-
Posted 09 April 2011 - 02:12 AM
Thanks! The downloaded script seems to be working fine:
Доверяй, но проверяй
/* * * * Compile_AHK SETTINGS BEGIN * * * [AHK2EXE] Exe_File=%In_Dir%\fadetoblack.exe Alt_Bin=C:\Program Files\AutoHotkey\Compiler\AutoHotkeySC_small.bin Execution_Level=2 [VERSION] Set_Version_Info=1 Company_Name=David Earls File_Description=Fade inactive windows File_Version=0.0.5.0 Inc_File_Version=0 Internal_Name=fadetoblack Legal_Copyright=David Earls Original_Filename=fadetoblack.ahk Product_Name=Fade to Black Product_Version=1.0.48.5 Set_AHK_Version=1 [ICONS] Icon_1=%In_Dir%\fadetoblack.ahk_1.ico * * * Compile_AHK SETTINGS END * * * */ ; ; AutoHotkey Version: 1.x ; Language: English ; Platform: WinNT ; Author: David Earls ; ; Script Function: ; Ghost inactive Windows like XFCE ; ; Attribution: The code to loop through windows was paraphrased from the AHK forums. ; script of Unambiguous adjusted for use with PSPad #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. SetTitleMatchMode, 2 #SingleInstance, force DetectHiddenWindows, Off iniread, TransLvl, fadetoblack.ini, Preferences, Transparent, 150 iniread, delay, fadetoblack.ini, Preferences, Delay, 0 ifexist %A_Windir%\System32\accessibilitycpl.dll menu, tray, icon, %A_Windir%\System32\accessibilitycpl.dll, 15 menu, tray, nostandard menu, tray, add, &Configure, Configure menu, tray, default, &Configure menu, tray, add menu, tray, add, E&xit, ExitRoutine menu, tray, tip, Fades Inactive Windows - Please exit properly. OnExit, ExitRoutine #Persistent SetTimer, CheckIfActive, 1000 return CheckIfActive: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% WinGet, Trans, Transparent, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ;Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd ;Look down continue if class = Button ;Start Menu continue ; if active task, Set vis. IfWinActive, ahk_id %id_trans% { winset, Transparent, Off, ahk_id %id_trans% continue } If Trans = %TransLvl% ; already Transparent continue if delay { if wininactive%ID_trans% < %delay% wininactive%ID_trans% += 1 else { Winset,Transparent, %TransLvl%, ahk_id %id_trans% wininactive%ID_min% = 0 } } else Winset,Transparent, %TransLvl%, ahk_id %id_trans% } return ExitRoutine: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ;Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd continue if class = Button ;you get a large square if you remove this. continue Winset,Transparent,off, ahk_id %id_trans% } ExitApp return Configure: gui, add, text,,Transparency: gui, add, text,,Ghost gui, add, slider,x+5 vTransSlider Range20-255 tooltip,%TransLvl% gui, add, text,x+5,HiDef gui, add, text,xm,`nInactivity Delay (Seconds): gui, add, text,,Zero gui, add, slider,x+5 tooltip vDelaySlider Range0-90, %delay% gui, add, text,x+5,Ninety gui, add, button,xm,&Save gui, show,,Configure return ;the gui buttonSave: gui, submit iniwrite, %TransSlider%, fadetoblack.ini, Preferences, Transparent iniwrite, %DelaySlider%, fadetoblack.ini, Preferences, Delay reload return GuiEscape: GuiClose: gui, destroy return return ;configure sub___________________
Доверяй, но проверяй
#10
-
Posted 09 April 2011 - 02:20 AM
Great! Now it's the weekend let's drink!
Thanks! The downloaded script seems to be working fine:
/* * * * Compile_AHK SETTINGS BEGIN * * * [AHK2EXE] Exe_File=%In_Dir%\fadetoblack.exe Alt_Bin=C:\Program Files\AutoHotkey\Compiler\AutoHotkeySC_small.bin Execution_Level=2 [VERSION] Set_Version_Info=1 Company_Name=David Earls File_Description=Fade inactive windows File_Version=0.0.5.0 Inc_File_Version=0 Internal_Name=fadetoblack Legal_Copyright=David Earls Original_Filename=fadetoblack.ahk Product_Name=Fade to Black Product_Version=1.0.48.5 Set_AHK_Version=1 [ICONS] Icon_1=%In_Dir%\fadetoblack.ahk_1.ico * * * Compile_AHK SETTINGS END * * * */ ; ; AutoHotkey Version: 1.x ; Language: English ; Platform: WinNT ; Author: David Earls ; ; Script Function: ; Ghost inactive Windows like XFCE ; ; Attribution: The code to loop through windows was paraphrased from the AHK forums. ; script of Unambiguous adjusted for use with PSPad #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. SetTitleMatchMode, 2 #SingleInstance, force DetectHiddenWindows, Off iniread, TransLvl, fadetoblack.ini, Preferences, Transparent, 150 iniread, delay, fadetoblack.ini, Preferences, Delay, 0 ifexist %A_Windir%\System32\accessibilitycpl.dll menu, tray, icon, %A_Windir%\System32\accessibilitycpl.dll, 15 menu, tray, nostandard menu, tray, add, &Configure, Configure menu, tray, default, &Configure menu, tray, add menu, tray, add, E&xit, ExitRoutine menu, tray, tip, Fades Inactive Windows - Please exit properly. OnExit, ExitRoutine #Persistent SetTimer, CheckIfActive, 1000 return CheckIfActive: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% WinGet, Trans, Transparent, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ;Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd ;Look down continue if class = Button ;Start Menu continue ; if active task, Set vis. IfWinActive, ahk_id %id_trans% { winset, Transparent, Off, ahk_id %id_trans% continue } If Trans = %TransLvl% ; already Transparent continue if delay { if wininactive%ID_trans% < %delay% wininactive%ID_trans% += 1 else { Winset,Transparent, %TransLvl%, ahk_id %id_trans% wininactive%ID_min% = 0 } } else Winset,Transparent, %TransLvl%, ahk_id %id_trans% } return ExitRoutine: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ;Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd continue if class = Button ;you get a large square if you remove this. continue Winset,Transparent,off, ahk_id %id_trans% } ExitApp return Configure: gui, add, text,,Transparency: gui, add, text,,Ghost gui, add, slider,x+5 vTransSlider Range20-255 tooltip,%TransLvl% gui, add, text,x+5,HiDef gui, add, text,xm,`nInactivity Delay (Seconds): gui, add, text,,Zero gui, add, slider,x+5 tooltip vDelaySlider Range0-90, %delay% gui, add, text,x+5,Ninety gui, add, button,xm,&Save gui, show,,Configure return ;the gui buttonSave: gui, submit iniwrite, %TransSlider%, fadetoblack.ini, Preferences, Transparent iniwrite, %DelaySlider%, fadetoblack.ini, Preferences, Delay reload return GuiEscape: GuiClose: gui, destroy return return ;configure sub___________________
Доверяй, но проверяй
#11
-
Posted 09 April 2011 - 02:27 AM
Heh, your script hit LifeHacker this morning and has gone viral, kudos for that.
Is there a way we could step the transparency as to give it an actual "FADE" effect? Not sure if it would be "pretty" enough to do a manual step via a loop or something (AHK-padawan learner here), or if there are other ways. Just figured if we could figure something like that out, it would appear more polished.
Loving the script btw, though I did change:
to 200, since the delay was buggin' like mad =]
Thanks!
P.S. Anyway we could kill the tray icon...it removed my usual AHK tray icon from another script I typically run, and I'd like to get it back =][/code]
EDIT: I figured out how to remove the Tray icon, just had to comment out said lines =] Thanks again!
Is there a way we could step the transparency as to give it an actual "FADE" effect? Not sure if it would be "pretty" enough to do a manual step via a loop or something (AHK-padawan learner here), or if there are other ways. Just figured if we could figure something like that out, it would appear more polished.
Loving the script btw, though I did change:
SetTimer, CheckIfActive, 1000
to 200, since the delay was buggin' like mad =]
Thanks!
P.S. Anyway we could kill the tray icon...it removed my usual AHK tray icon from another script I typically run, and I'd like to get it back =][/code]
EDIT: I figured out how to remove the Tray icon, just had to comment out said lines =] Thanks again!
#12
-
Posted 11 April 2011 - 04:03 PM
I noticed that if I changed the timer from 1000 to 200, AutoHotKey was taking 6% of my CPU.
I moved the Exclusions section and the processname line after the checks for title and class, and it dropped to 1%.
Awesome script by the way!
I moved the Exclusions section and the processname line after the checks for title and class, and it dropped to 1%.
Awesome script by the way!
; ; AutoHotkey Version: 1.x ; Language: English ; Platform: WinNT ; Author: David Earls ; ; Script Function: ; Ghost inactive Windows like XFCE ; ; Attribution: The code to loop through windows was paraphrased from the AHK forums. ; script of Unambiguous adjusted for use with PSPad #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. SetTitleMatchMode, 2 #SingleInstance, force DetectHiddenWindows, Off iniread, TransLvl, fadetoblack.ini, Preferences, Transparent, 150 iniread, delay, fadetoblack.ini, Preferences, Delay, 0 ifexist, %A_Windir%\System32\accessibilitycpl.dll menu, tray, icon, %A_Windir%\System32\accessibilitycpl.dll, 15 menu, tray, nostandard menu, tray, add, &Configure, Configure menu, tray, default, &Configure menu, tray, add menu, tray, add, E&xit, ExitRoutine menu, tray, tip, Fades Inactive Windows - Please exit properly. OnExit, ExitRoutine #Persistent SetTimer, CheckIfActive, 200 return CheckIfActive: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% If title = continue WinGetClass class , ahk_id %this_id% if class = Shell_TrayWnd ;Look down continue if class = Button ;Start Menu continue winget processname,processname, ahk_id %this_id% ;Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue WinGet, id_trans, ID, ahk_id %this_id% WinGet, Trans, Transparent, ahk_id %this_id% ; if active task, Set vis. IfWinActive, ahk_id %id_trans% { winset, Transparent, Off, ahk_id %id_trans% continue } If Trans = %TransLvl% ; already Transparent continue if delay { if wininactive%ID_trans% < %delay% wininactive%ID_trans% += 1 else { Winset,Transparent, %TransLvl%, ahk_id %id_trans% wininactive%ID_min% = 0 } } else Winset,Transparent, %TransLvl%, ahk_id %id_trans% } return ExitRoutine: WinGet, id, list, , , Program Manager Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 WinGetTitle, title, ahk_id %this_id% WinGet, id_trans, ID, ahk_id %this_id% winget processname,processname, ahk_id %this_id% WinGetClass class , ahk_id %this_id% ;Exclusions if ( processname = "PSPad.exe" and class = "TApplication" ) continue If title = continue if class = Shell_TrayWnd continue if class = Button ;you get a large square if you remove this. continue Winset,Transparent,off, ahk_id %id_trans% } ExitApp return Configure: gui, add, text,,Transparency: gui, add, text,,Ghost gui, add, slider,x+5 vTransSlider Range20-255 tooltip,%TransLvl% gui, add, text,x+5,HiDef gui, add, text,xm,`nInactivity Delay (Seconds): gui, add, text,,Zero gui, add, slider,x+5 tooltip vDelaySlider Range0-90, %delay% gui, add, text,x+5,Ninety gui, add, button,xm,&Save gui, show,,Configure return ;the gui buttonSave: gui, submit iniwrite, %TransSlider%, fadetoblack.ini, Preferences, Transparent iniwrite, %DelaySlider%, fadetoblack.ini, Preferences, Delay reload return GuiEscape: GuiClose: gui, destroy return return ;configure sub
#13
-
Posted 11 April 2011 - 06:19 PM