Jump to content


Photo

*LATEST UPDATE - 08/21/2012* Thumb_Expose - Expose Clone


  • Please log in to reply
3 replies to this topic

#1 Coco

Coco
  • Members
  • 606 posts

Posted 18 August 2012 - 07:34 AM

This is my simple version of Mac's Expose, inspired by Holomind's Real Expose Clone(<!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?t=13001">viewtopic.php?t=13001</a><!-- l -->). Currently, it only works on Windows 7(tested) or Windows Vista. It requires maul.esel's Aero Thumbnail Library(<!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?t=70839">viewtopic.php?t=70839</a><!-- l -->).

[attachment=0]<!-- ia0 -->Thumb_Expose.ahk<!-- ia0 -->[/attachment]

[attachment=2]<!-- ia2 -->Thumbnail.ahk<!-- ia2 -->[/attachment]

Latest update (08/21/2012)
- Can now be activated with hot corner(s) - multiple corners(depending on the user). Top left is set by default.
;~ Hot Corners
; CONFIGURE HOT CORNERS HERE | You can configure multiple hot corners, change "0" to "1" to enable the particular corner
;======================================
topleft = 1
topright = 0
bottomleft = 0
bottomright = 0
pixels = 2 ; Distance in pixels
delay = 1500 ; Delay in milliseconds, this is to prevent accidental activation
;=======================================
Previous Updates (08/19/2012)
- Enhanced transition effect. Now much smoother and faster.
- Improved fade-out, it now synchronizes with the thumbnail during animation.
- Tasks/windows are now totally hidden, I didn't try to hide them in the last version, they were visible through the semi-transparent background.
Previous Update:
- The new version does not run automatically, it nows run in the background and you can invoke/start Expose-mode with a hotkey, default is F8.

Instructions, Hotkeys:
Put the two files in the same directory and run Thumb_Expose.ahk

F8 -Start Expose
LButton - choose a thumbnail/task
RButton - will center the currently selected thumbnail, bringing it into the foreground. Resizes it to its original size, this acts as a preview/zoom.
NumPad(0 - 9) and any of the number keys - depending on the number of visible windows. The number you press will activate the corresponding window.
Esc - terminates the script

Limitations/Known issues:
Does not currently show minimized windows. No multi-monitor support(I plan to add this feature). Some flaws in "transition" effects.

To Do's:
- Create interface so that settings(hotkeys, custom background, etc.) can be customized.
- Enhance "transition" effects. Improve thumbnail(s) animation.
- Add multi-monitor support.

Thanks to:
maul.esel - for his Aero Thumbnail library
Holomind - for the inspiration(I borrowed some lines from his Real Expose Clone)
SKAN - for his tip on how to get current column or row position(<!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?f=1&t=89396">viewtopic.php?f=1&t=89396</a><!-- l -->)
and others - see comments in script

Thumb_Expose in action:
Posted Image

Thumb_Expose (Preview-Zoom Mode)
Posted Image

Here's the code if the download fails:
; Many thanks to maul.esel for his Thumbnail.ahk library
; Thumbnail.ahk required(http://www.autohotkey.com/community/viewtopic.php?t=70839)

#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.

SetBatchLines, -1
#SingleInstance force
#Include Thumbnail.ahk
;~ #NoTrayIcon
DetectHiddenWindows, Off

;~ Config
min_h = 110 ; Minimum height of windows to show
min_w = 110 ;  Minimum width of windows to show
wWorkArea := (A_ScreenWidth + 16)
hWorkArea := (A_ScreenHeight + 16)
bg_Trans = 210
bg_Color = 0
Prev_State = 0

;~ Get Active Window
WinGetTitle, active_Title, A
;~ WinGet, active_Task, ID, A
;~ WinGetPos, x_Active, y_Active,,, A
if active_Title = Program Manager
ExitApp

;~ GUI
;~ ; Background Window
Gui, Gui:-Caption +ToolWindow +Hwndu_hWin
Gui, Gui:Color, %bg_Color%
Gui, Gui:Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight% Hide, uWin

;~ Destination Window
Gui, 2Gui:+OwnerGui -Caption +ToolWindow +HwndhWin
Gui, 2Gui:Color, 383838
Gui, 2Gui:Show, x-8 y-8 w%wWorkArea% h%hWorkArea% Hide, Win

;~ Key Mapping
; SET YOUR HOTKEY HERE
;=======================================
ExposeKey := "F8"
ExitAppKey := "Esc"
;=======================================
Hotkey, %ExposeKey%, Start_Expose
Hotkey, LButton, Pre_Activation, Off ; Hotkey to choose window
Hotkey, Enter, Pre_Activation, Off
Hotkey, RButton, Preview_Window, Off ; Hotkey to zoom/preview thumbnail
HotKey, %ExitAppKey%, Exit

;~ Hot Corners
; CONFIGURE HOT CORNERS HERE | You can configure multiple hot corners, change "0" to "1" to enable the particular corner
;======================================
topleft = 1
topright = 0
bottomleft = 0
bottomright = 0
pixels = 2 ; Distance in pixels
delay = 1500 ; Delay in milliseconds, this is to prevent accidental activation
;=======================================

; Create Desktop thumbnail
WinGet, desk_ID, ID, Program Manager
thumb_Desk := Thumbnail_Create(hWin, desk_ID)
xSource := 0, ySource := 0
Thumbnail_GetSourceSize(thumb_Desk, wSource, hSource)
ThumbPosGrid(thumb_Desk, "1", "1", xDest, yDest, wDest, hDest, "300") ; change "300" to "0" if you want the full desktop background, then you wouldn't need the first GUI
Thumbnail_SetRegion(thumb_Desk, xDest, yDest, wDest, hDest, xSource, ySource, wSource, hSource)
Thumbnail_SetOpacity(thumb_Desk, "255")
;~ Thumbnail_Show(thumb_Desk)
Thumbnail_Hide(thumb_Desk)
CoordMode, Mouse, Screen
SetTimer, MonitorHotCorners, 250
; Un-comment the next two lines if you want to reduce memory consumtion
PID := DllCall("GetCurrentProcessId")
EmptyMem(PID)
return
;==============================================================
; End of auto-execute section
;==============================================================

Initialize:
;~ Get list of processes
WinGet, ids, List,,, Program Manager
num_Win = 

;~ Create array/objects
task_List := "", thumb_List := ""
task_List := Object() ; Create array/object to store ID of tasks/processes
thumb_List := Object() ; Create array/object to store ID of thumbnails

;~ Store hwnd of tasks in array
Loop, %ids%
{
	task_ID := ids%A_Index%
	WinGetTitle, title, ahk_id %task_ID%
	WinGetPos,,, w, h, ahk_id %task_ID%
	if Window_Hidden()
		continue
	num_Win++ ; Counter to keep track of the number of windows as well as thumbnails
	i++ ; Will use this counter in the thumbnail creation process
	task_List.Insert(task_ID)
}

cols := Ceil(Sqrt(num_Win)), rows := Ceil(Sqrt(num_Win))
If (cols*(rows-1) >= num_Win)
	rows--

;~ Create Thumbnails | Creation is done in reverse/descending order so that the active window's thumbnail is set on top of the stack. Thumbnail order is the same with z-order of the windows
for k, v in task_List
{
	Source := task_List[i] ; Retrieve window(s) hwnd. Also in reverse order. Last thumbnail created will most likely be the active window or in some cases 
	thumb := Thumbnail_Create(hWin, Source) ; Create the thumbnail
	thumb_List.Insert(1, thumb) ; Store thumbnail handle in array
	i-- ; Counter starts at n number of tasks/windows going down every iteration
}
return

Start_Expose:
gosub, Initialize
WinSet, Trans, 0, ahk_group task_Group
action := "-"

;~ Set initial and actual grid position of thumbnails -> for animation purposes
Loop, % num_Win ; Cycle through the task(s) and the thumbnail(s) | Set thumbnail(s) properties
{
	task := task_List[A_Index] ; retrieve window(s) ID's
	thumb_%A_Index% := thumb_List[A_Index] ; retrieve thumbnail handle
	WinGetPos, X%A_Index%, Y%A_Index%,,, ahk_id %task% ; get source window(s) x and y coordiantes
	xSource%A_Index% := 0, ySource%A_Index% := 0
	Thumbnail_GetSourceSize(thumb_%A_Index%, wSource%A_Index%, hSource%A_Index%) ; get source window(s) width and height
	ThumbPosGrid(thumb_%A_Index%, A_Index, num_Win, new_xDest%A_Index%, new_yDest%A_Index%, new_wDest%A_Index%, new_hDest%A_Index%) ; establish thumbnail(s) position in grid
	
	old_xDest%A_Index% := X%A_Index%, old_yDest%A_Index% := Y%A_Index%, old_wDest%A_Index% := wSource%A_Index%, old_hDest%A_Index% := hSource%A_Index% ; Position prior animation
	old_xDest%A_Index% := old_xDest%A_Index% + 8, old_yDest%A_Index% := old_yDest%A_Index% + 8 ; adjust offset
	Opacity := 255
	includeNC := True
	
	Thumbnail_SetRegion(thumb_%A_Index%, old_xDest%A_Index%, old_yDest%A_Index%, old_wDest%A_Index%, old_hDest%A_Index%, xSource%A_Index%, ySource%A_Index%, wSource%A_Index%, hSource%A_Index%) ; Set initial position
	Thumbnail_SetOpacity(thumb_%A_Index%, Opacity)
	Thumbnail_SetIncludeNC(thumb_%A_Index%, includeNC)
	Thumbnail_Show(thumb_%A_Index%)
}
Thumbnail_SetOpacity(thumb_Desk, Opacity)
Thumbnail_Show(thumb_Desk)

;~ Show GUI | Show thumbnails
Gui, Gui:Show
WinSet, Transparent, 210, uWin
Gui, 2Gui:Show
WinSet, AlwaysOnTop, On, Win
WinSet, TransColor, 383838, Win
Loop, % num_win ; Hide the windows by setting their transparency to "0"
{
	task := task_List[A_Index]
	WinSet, Trans, 0, ahk_id %task%
}
Sleep, 100 ; short delay before animation
gosub, Animate

Loop, % num_Win ; Create "number" and "Numpad" hotkeys for window activation		
{
	String2Hotkey(A_Index, "Pre_Activation",, "On")
	String2Hotkey(A_Index, "Pre_Activation", "Numpad", "On")
}
Hotkey, %ExposeKey%, Off
Hotkey, LButton, On
Hotkey, Enter, On
Hotkey, RButton, On
action := "+"
hCurs:=DllCall("LoadCursor", "UInt", NULL,"Int", 32649, "UInt") ; IDC_HAND := 32649, IDC_CROSS := 32515
OnMessage(0x200,"WM_MOUSEMOVE")
CoordMode, Mouse, Relative
SetTimer, MonitorHotCorners, Off
return

Animate: ; Animate thumbnails
i := ; Counter
Steps := 2
Loop, % num_Win * 11 ; Still need to experiment to come up with a constant number
{
	i++
	xsteps%i% := round(abs(new_xDest%i% - old_xDest%i%) / Steps), ysteps%i% := round(abs(new_yDest%i% - old_yDest%i%) / Steps)
	wsteps%i% := round(abs(new_wDest%i% - old_wDest%i%) / Steps), hsteps%i% := round(abs(new_hDest%i% - old_hDest%i%) / Steps)
	xDest%i% := (new_xDest%i% > old_xDest%i%) ? (old_xDest%i% += xsteps%i%) : (old_xDest%i% -= xsteps%i%)
	yDest%i% := (new_yDest%i% > old_yDest%i%) ? (old_yDest%i% += ysteps%i%) : (old_yDest%i% -= ysteps%i%)
	if (action = "-")
		wDest%i% := old_wDest%i% -= wsteps%i%, hDest%i% := old_hDest%i% -= hsteps%i%
	else if (action = "+")
		wDest%i% := old_wDest%i% += wsteps%i%, hDest%i% := old_hDest%i% += hsteps%i%
	Thumbnail_SetRegion(thumb_%i%, xDest%i%, yDest%i%, wDest%i%, hDest%i%, xSource%i%, ySource%i%, wSource%i%, hSource%i%) ; Set thumbnail(s) region until actual grid position is reached
	if i = %num_Win% ; Reset counter
	{
		i = 0
		Sleep, 1
	}
}
;~ PID := DllCall("GetCurrentProcessId")
;~ EmptyMem(PID)
return

Pre_Activation:
gosub, % (Prev_State = "0") ? "Activate_Window" : "End_Preview"
return

Activate_Window:
if A_ThisHotkey in LButton,Enter ;  Activation via mouse
{
	MouseGetPos, X, Y
	Pos := 1 + X*cols//wWorkArea + Y*rows//hWorkArea * cols ; line taken from Holomind's Real Expose Clone
	chosen_Task := task_List[Pos]
	thumb := thumb_List[Pos]
	ThumbPosGrid(thumb, Pos, num_Win, left, top, right, bottom)
	right := (left + right), bottom := (top + bottom)
	if (Pos <= num_Win and X >= left and X <= right and Y >= top and Y <= bottom)
	{
		gosub, Animate_Out
		ID := task_List[Pos]
		WinActivate(ID)
		gosub, End_Expose
	}
}
else ; activation via hotkey
{
	Pos := A_ThisHotkey
	if Pos contains &,Numpad
		Pos := Digitize(Pos)
	chosen_Task := task_List[Pos]
	gosub, Animate_Out
	ID := task_List[Pos]
	WinActivate(ID)
	gosub, End_Expose
}
return

Animate_Out: ; Exit expose mode
chosen_Thumb := Thumbnail_Create(hWin, chosen_Task) ; Create thumbnail copy - this to set the chosen thumbnail on top of the other thumbnails
old_Thumb := thumb_List.Remove(Pos) ; Store handle of copied thumbnail - for destruction purposes
thumb_List.Insert(Pos, chosen_Thumb) ; insert new thumbnail in array

xSource := 0, ySource := 0
Thumbnail_GetSourceSize(chosen_Thumb, wSource, hSource)
ThumbPosGrid(chosen_Thumb, Pos, num_Win, xDest, yDest, wDest, hDest)
Opacity := 255, includeNC := True

Thumbnail_SetRegion(chosen_Thumb, xDest, yDest, wDest, hDest, xSource, ySource, wSource, hSource)
Thumbnail_SetOpacity(chosen_Thumb, Opacity)
Thumbnail_SetIncludeNC(chosen_Thumb, includeNC)
Thumbnail_Show(chosen_Thumb) ; Show the thumbnail copy
Thumbnail_Hide(old_Thumb) ; Hide the original thumbnail

Loop, % num_Win
{
	task := task_List[A_Index]
	thumb_%A_Index% := thumb_List[A_Index]
	WinGetPos, X%A_Index%, Y%A_Index%,,, ahk_id %task%
	xSource%A_Index% := 0, ySource%A_Index% := 0
	Thumbnail_GetSourceSize(thumb_%A_Index%, wSource%A_Index%, hSource%A_Index%)
	ThumbPosGrid(thumb_%A_Index%, A_Index, num_Win, old_xDest%A_Index%, old_yDest%A_Index%, old_wDest%A_Index%, old_hDest%A_Index%)
	
	new_xDest%A_Index% := X%A_Index%, new_yDest%A_Index% := Y%A_Index%, new_wDest%A_Index% := wSource%A_Index%, new_hDest%A_Index% := hSource%A_Index% ; 
	new_xDest%A_Index% := new_xDest%A_Index% + 8, new_yDest%A_Index% := new_yDest%A_Index% + 8 ; adjust offset
	Opacity := 255
	includeNC := True
}
SetTimer, Fade_Out, 250
Sleep, 100 ; Slight delay to synchornize the fading out with the animation.
gosub, Animate
Loop, % num_win ; Show the previously hidden windows by resetting their transparency level
{
	task := task_List[A_Index]
	WinSet, Trans, 255, ahk_id %task%
}
;~ FadeOut("uWin", "0", "250", "0")
return

Fade_Out: ; Fade background out. Need to implement a much smoother fade out effect.
SetTimer, Fade_Out, Off
o := 210
Loop
{
	Opacity -= 17
	o -= 14
	WinSet, Transparent, %o%, uWin
	Thumbnail_SetOpacity(thumb_Desk, Opacity)
	Sleep, 1
} until Opacity <= 0 && o <= 0
return
	
Preview_Window:
gosub, % (Prev_State = "0") ? "Start_Preview" : "End_Preview"
return
	
Start_Preview:
MouseGetPos, X, Y
prev_Pos := 1 + X*cols//wWorkArea + Y*rows//hWorkArea * cols
task_Prev := task_List[prev_Pos]
thumb_Hide := thumb_List[prev_Pos] ; Handle of the thumbnail being copied
thumb_Prev := Thumbnail_Create(hWin, task_Prev) ; Create thumbnail copy - this to set the chosen thumbnail on top of the other thumbnails
ThumbPosGrid(thumb_Prev, prev_Pos, num_Win, left, top, right, bottom)
right := (left + right), bottom := (top + bottom)
if (Pos <= num_Win and X >= left and X <= right and Y >= top and Y <= bottom)
{
	xSource = 0, ySource = 0
	Thumbnail_GetSourceSize(thumb_Prev, wSource, hSource)
	ThumbPosGrid(thumb_Prev, "1", "1", xPrev, yPrev, wPrev, hPrev, "0", "Win")
	ThumbPosGrid(thumb_Prev, prev_Pos, num_Win, xDest, yDest, wDest, hDest)
	Opacity := 255, includeNC := True
	
	Thumbnail_SetRegion(thumb_Prev, xDest, yDest, wDest, hDest, xSource, ySource, wSource, hSource)
	Thumbnail_SetOpacity(thumb_Prev, Opacity)
	Thumbnail_SetIncludeNC(thumb_Prev, includeNC)
	Thumbnail_Show(thumb_Prev) ; Show the thumbnail copy
	Thumbnail_Hide(thumb_%prev_Pos%) ; Hide the original thumbnail
	
	ThumbAnimate(thumb_Prev, xDest, yDest, wDest, hDest, xPrev, yPrev, wPrev, hPrev, "2") ; Function to animate a thumbnail -> single thuumbnail animation only
	Prev_State = 1
}
return
	
End_Preview:
ThumbPosGrid(thumb_Prev, prev_Pos, num_Win, xDest, yDest, wDest, hDest)
ThumbAnimate(thumb_Prev, xPrev, yPrev, wPrev, hPrev, xDest, yDest, wDest, hDest, "2")
Thumbnail_Show(thumb_Hide)
Thumbnail_Destroy(thumb_Prev)
Prev_State = 0
return

End_Expose:
Thumbnail_Hide(thumb_Desk)
Thumbnail_Destroy(old_Thumb)
Loop, %num_Win%
{
	thumb_%A_Index% := thumb_List[A_Index]
	Thumbnail_Destroy(thumb_%A_Index%)
}
Hotkey, %ExposeKey%, On
Hotkey, LButton, Off
Hotkey, Enter, Off
Hotkey, RButton, Off
Loop, % num_Win ; Turn off the previously created dynamic hotkeys
{
	String2Hotkey(A_Index, "Pre_Activation",, "Off")
	String2Hotkey(A_Index, "Pre_Activation", "Numpad", "Off")
}
OnMessage(0x200,"") 
DllCall("DestroyCursor","Uint",hCurs)
Gui, 2Gui:Hide
Gui, Gui:Hide
CoordMode, Mouse, Screen
SetTimer, MonitorHotCorners, 250
return

MonitorHotCorners:
if (topleft = 1 || topright = 1 || bottomleft = 1 || bottomright = 1)
	HotCorners(topleft, topright, bottomleft, bottomright, pixels, delay)
else
	SetTimer, MonitorHotCorners, Off ; Turn off timer if no hot corner(s) is configured
return
	
Exit:
Loop, % num_win
{
	task := task_List[A_Index]
	WinGet, Trans, Transparent, ahk_id %task%
	if Trans = 0
		WinSet, Trans, 255, ahk_id %task%
}
Thumbnail_Destroy(thumb_Desk)
Thumbnail_Destroy(old_Thumb)
Loop, %num_Win%
{
	thumb_%A_Index% := thumb_List[A_Index]
	Thumbnail_Destroy(thumb_%A_Index%)
}
OnMessage(0x200,"") 
DllCall("DestroyCursor","Uint",hCurs)
Gui, Gui:Destroy
ExitApp
	
;====================================================================================
; FUNCTIONS
;====================================================================================
	
ThumbPosGrid(hThumb, ItemIndex, ItemCount, ByRef xDest, ByRef yDest, ByRef wDest, ByRef hDest, Spacing="20", Coord="Screen") ; This function sets the position of the thumbnail(s) in a grid
{                                                                                                                            ; It can also retrieve a thumbnail's region/dimension/property.
	cols := Ceil(Sqrt(ItemCount)), rows := Ceil(Sqrt(ItemCount))                                                             ; Specify "Screen" in the "Coord" parameter to postion the
	if (cols*(rows-1) >= ItemCount)                                                                                          ; thumbnail relative to the screen otherwise "Win" to postion it
		rows--                                                                                                               ; relative to the destination window
	if (Coord = "Screen")                                                                                                    
		wGrid :=  A_ScreenWidth / cols, hGrid := A_ScreenHeight / rows
	if (Coord = "Win")
		wGrid :=  (A_ScreenWidth / cols) + (16 / cols), hGrid := (A_ScreenHeight / rows) + (16 / rows)
	Thumbnail_GetSourceSize(hThumb, wSource, hSource)
	area_Ratio := wGrid / hGrid, win_Ratio := wSource / hSource
	if (win_Ratio < area_Ratio)
		hDest := hGrid - Spacing, wDest := round(wSource / hSource * hDest)
	else	
		wDest := wGrid - Spacing, hDest := round(hSource / wSource * wDest)
	if ( wDest > wSource or hDest > hSource )
		hDest := hSource, wDest := wSource
	pos_Cols := ( C := Mod( ItemIndex, cols ) ) ? C : cols, pos_Rows := Ceil( ItemIndex / cols ) ; thanks to SKAN for this tip
	if (Coord = "Screen")
		xDest := (wGrid/2)-(wDest/2) + (wGrid*(pos_Cols-1)) + 8, yDest := (hGrid/2)-(hDest/2) + (hGrid*(pos_Rows-1)) + 8
	if (Coord = "Win")
		xDest := (wGrid/2)-(wDest/2) + (wGrid*(pos_Cols-1)), yDest := (hGrid/2)-(hDest/2) + (hGrid*(pos_Rows-1))
}

ThumbAnimate(hThumb, xOld, yOld, wOld, hOld, xNew, yNew, wNew, hNew, Steps="2") ; Single thumbnail animation only -> used in the Start_Preview, End_Preview subroutine(s)
{
	abs(wNew - wOld) != 0 or abs(hNew - hOld) != 0 ? ((wNew > wOld or hNew > hOld) ? action := "+" : action := "-") : wDest := wOld += abs(wNew - wOld), hDest := hOld += abs(hNew - hOld)
	xSource := 0, ySource := 0, Thumbnail_GetSourceSize(hThumb, wSource, hSource)
	Loop
	{
		xsteps := round(abs(xNew - xOld) / Steps), ysteps := round(abs(yNew - yOld) / Steps)
		if action in +,-
			wsteps := round(abs(wNew - wOld) / Steps), hsteps := round(abs(hNew - hOld) / Steps)
		xDest := (xNew > xOld) ? (xOld += xsteps) : (xOld -= xsteps)
		yDest := (yNew > yOld) ? (yOld += ysteps) : (yOld -= ysteps)
		if (action = "-") 
			wDest := wOld -= wsteps, hDest := hOld -= hsteps
		else if (action = "+")
			wDest := wOld += wsteps, hDest := hOld += hsteps
		Thumbnail_SetRegion(hThumb, xDest, yDest, wDest, hDest, xSource, ySource, wSource, hSource)
		Sleep, 21
	} Until xsteps <= 0 && ysteps <= 0 && wsteps <= 0 && hsteps <= 0
}

HotCorners(topleft, topright, bottomleft, bottomright, pixels="2", delay="1000")
{
	Sleep, % delay
	MouseGetPos, X, Y
	if (X <= pixels && Y <= pixels && topleft = 1)
		gosub, Start_Expose
	if (X >= A_ScreenWidth - pixels && Y <= pixels && topright = 1)
		gosub, Start_Expose
	if (X <= pixels && Y >= A_ScreenHeight - pixels && bottomleft = 1)
		gosub, Start_Expose
	if (X >= A_ScreenWidth - pixels && Y >= A_ScreenHeight - pixels && bottomright = 1)
		gosub, Start_Expose
}

; The next two functions were taken from holomind's Real Expose Clone (http://www.autohotkey.com/community/viewtopic.php?t=13001) -> the inspiration for this script
Window_Hidden() { ; borrowed from holomind's Real Expose Clone
global
Return w < min_w or h < min_h or title = "" or active_Title = ""
}

WinActivate(ID) ; borrowed from holomind's Real Expose Clone
{
	WinGet, ActiveID, ID, A
	if ActiveID <> ID
		WinActivate ahk_id %ID%
}

Digitize(var) ; Removes non-numerical characters in a string
{
	StringReplace, var, var, %A_Space%,, a
	Loop, Parse, var
	{
		if A_LoopField is not Integer
			StringReplace, var, var, %A_LoopField%,, a
	}
	return var
}

String2Hotkey(String, Label, KeyType="Normal", Options="") ; Converts 2-character string into a hotkey. Useful for the 'Hotkey' command. It just actually inserts " & " in between.
{
	StringReplace, String, String, %A_Space%,, A
	Len := StrLen(String)
	if KeyType = Normal
	{
		Loop, Parse, String
		{
			if A_Index = % Len
				String := A_LoopField
			else
				String := A_LoopField " & "
			Key .= String
		}
	}
	if KeyType = Numpad
	{
		Loop, Parse, String
		{
			String := "Numpad" A_LoopField
			if A_Index = % Len
				String := String
			else
				String := String " & "
			Key .= String
		}
	}
	Hotkey, %Key%, %Label%, %Options%
}

FadeOut(window = "A", end = 0, speed = 10, close = 1) ; http://www.autohotkey.com/community/viewtopic.php?t=71886
{
	WinGet, currentTrans, Transparent, %window%
	If (currentTrans == "")
	{
		WinSet, Trans, 255, %window%
		WinGet, currentTrans, Transparent, %window%
	}
	While, (currentTrans > end)
	{
		Sleep, % speed / 2
		Trans := currentTrans - speed
		WinSet, Trans, %Trans%, %window%
		WinGet, currentTrans, Transparent, %window%
	}
	If (close == 1)
		WinClose, %window%
}

EmptyMem(PIDtoEmpty) ; http://www.autohotkey.com/forum/topic32876.html (first line removed)
{
	h:=DllCall("OpenProcess", "UInt", 0x001F0FFF, "Int", 0, "Int", PIDtoEmpty)
	DllCall("SetProcessWorkingSetSize", "UInt", h, "Int", -1, "Int", -1)
	DllCall("CloseHandle", "Int", h)
}

WM_MOUSEMOVE(wParam,lParam) ; http://www.autohotkey.com/community/viewtopic.php?t=9192
{
	Global
	MouseGetPos, X, Y
	Pos := 1 + X*cols//wWorkArea + Y*rows//hWorkArea * cols
	Prev_State <= 0 ? ((Count := num_Win), (Pos := Pos), ThumbPosGrid(thumb_%Pos%, Pos, Count, left, top, right, bottom)) : ((Count := "1"), (Pos := "1"), ThumbPosGrid(thumb_Prev, Pos, Count, left, top, right, bottom, "0", "Win"))
	right := (left + right), bottom := (top + bottom)
	if (Pos <= Count and X >= left and X <= right and Y >= top and Y <= bottom)
		DllCall("SetCursor","UInt",hCurs)
	Return
}

I still plan to add some functionality and need to fix some bugs and improve current features. Comments and suggestions are very much welcome. Please report if you experience any bugs(e.g. script not working, etc) Hope you enjoy it.)
}
OnMessage(0x200,

#2 Guests

  • Guests

Posted 18 August 2012 - 09:01 AM

Nice, reminds me of Dexpot

#3 Coco

Coco
  • Members
  • 606 posts

Posted 18 August 2012 - 01:28 PM

Thanks, the latest version of Dexpot, v. 1.6 is real major update with tons of new features.

#4 Coco

Coco
  • Members
  • 606 posts

Posted 20 August 2012 - 11:21 PM

I've added hot corner(s) activation. It supports multiple corners if preferred. See first post! ;)