Messages - skrommel [ switch to compact view ]

Pages: prev1 ... 21 22 23 24 25 [26] 27 28 29 30 31 ... 187next
126
 :) Nothing fancy, but try ThinTimer!

It shows a thin progress bar on the top edge of the screen.

Skrommel

;ThinTimer.ahk
; Shows a thin progress bar on the top edge of the screen
;Skrommel @ 2008

alarm=034500   ;Alarm time HHMMSS
height=2       ;Progress bar height >0
message=Timer!  ;Message to display when timer reached

#NoEnv
#SingleInstance,Force

range:=A_YYYY . A_MM . A_DD . alarm
EnvSub,range,%A_now%,seconds

Gui,+ToolWindow +AlwaysOnTop -Caption
Gui,Add,Progress,% "Vprogress X-2 Y-2 W" A_ScreenWidth+4 " H" height+5 " Range0-" range
Gui,Show,% "X0 Y0 W" A_ScreenWidth " H" height
Gui,+LastFound
guiid:=WinExist("A")
WinSet,Transparent,150,ahk_id %guiid%  ; Transparency
WinSet,ExStyle,+0x20,ahk_id %guiid%    ; Click-through

Loop,%range%
{
  Sleep,1000
  GuiControl,,progress,% range-A_Index
}
If message<>
  MsgBox,%message%
ExitApp

127
Coding Snacks / Re: IDEA: focus get (and keep, for a while)
« on: November 08, 2008, 12:09 PM »
 :) Try ReFocus!

- Refocuses a window after 5 seconds of inactivity.
- Press F1 to change the window to refocus.

Skrommel

;ReFocus.ahk
; Refocuses a window after 5 seconds of inactivity.
; Press F1 to change the window to refocus.
;Skrommel @ 2008

idletime=5000
focus:=WinExist("Notepad")

#SingleInstance,Force
#NoEnv
SetWinDelay,0

applicationname=ReFocus

SetTimer,TIMER,1000

TrayTip,%applicationname%,- Refocuses a window after 5 seconds of inactivity.`n- Press F1 to change the window to refocus.
Return

F1::
focus:=WinExist("A")
WinGetActiveTitle,title
TrayTip,%applicationname%,%title%
Return


TIMER:
IfWinNotActive,ahk_id %focus%
If (A_TimeIdlePhysical>idletime)
  WinActivate,ahk_id %focus%
Return

128
Post New Requests Here / Re: Auto Resize Taskbar
« on: November 06, 2008, 07:14 PM »
 :) Try TaskbarSize - it resizes the taskbar when it gets too crowded.

This is a very simple hack, I'll see if I can find a better way of sizing the taskbar.

Skrommel


;TaskbarSize.ahk
; Resizes the taskbar when it gets too crowded
;Skrommel @ 2008

#SingleInstance,Force
DetectHiddenWindows, On
SetWinDelay,0

WinMove,ahk_class Shell_TrayWnd,,100,0

buttonlimit=5

WinGetPos,tx,ty,tw,th,ahk_class Shell_TrayWnd

WinGet, pidTaskbar, PID, ahk_class Shell_TrayWnd
hProc:= DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar)
pProc:= DllCall("VirtualAllocEx", "Uint", hProc, "Uint", 0, "Uint", 32, "Uint", 0x1000, "Uint", 0x4)
idxTB:= GetTaskSwBar()
oldbuttons:=buttons
SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd   ; TB_BUTTONCOUNT
previous:=ErrorLevel

Loop
{
  Sleep,1000
  idxTB:= GetTaskSwBar()
  oldbuttons:=buttons
  SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd   ; TB_BUTTONCOUNT
  buttons:=ErrorLevel
  If (oldbuttons=buttons)
    Continue
  If (buttons>previous+buttonlimit)
  {
    winid:=WinExist("A")
    WinActivate, ahk_class Shell_TrayWnd
    PostMessage, 0x112, 0xF000,,, ahk_class Shell_TrayWnd  ; SC_SIZE
    MouseGetPos,mx,my
    BlockInput,On
MouseClickDrag,L,1,1,1,-50,0
    BlockInput,Off
    MouseMove,% mx,% my,0
    WinActivate,ahk_id %winid%
  previous:=previous+buttonlimit
}
  If (buttons<previous-buttonlimit)
  {
    winid:=WinExist("A")
    WinActivate, ahk_class Shell_TrayWnd
    PostMessage, 0x112, 0xF000,,, ahk_class Shell_TrayWnd  ; SC_SIZE
    MouseGetPos,mx,my
    BlockInput,On
MouseClickDrag,L,1,1,1,50,0
    BlockInput,Off
    MouseMove,% mx,% my,0
    WinActivate,ahk_id %winid%
    previous:=previous-buttonlimit
  }
}
Return

;Stolen from Sean at http://www.autohotkey.com/forum/viewtopic.php?t=18652
TaskButtons(sExeName = "")
{
WinGet, pidTaskbar, PID, ahk_class Shell_TrayWnd
hProc:= DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar)
pProc:= DllCall("VirtualAllocEx", "Uint", hProc, "Uint", 0, "Uint", 32, "Uint", 0x1000, "Uint", 0x4)
idxTB:= GetTaskSwBar()
SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd   ; TB_BUTTONCOUNT
Loop, %ErrorLevel%
{
SendMessage, 0x417, A_Index-1, pProc, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd   ; TB_GETBUTTON
VarSetCapacity(btn,32,0)
DllCall("ReadProcessMemory", "Uint", hProc, "Uint", pProc, "Uint", &btn, "Uint", 32, "Uint", 0)
iBitmap := NumGet(btn, 0)
idn := NumGet(btn, 4)
Statyle := NumGet(btn, 8)
If dwData := NumGet(btn,12)
iString := NumGet(btn,16)
Else dwData := NumGet(btn,16,"int64"), iString:=NumGet(btn,24,"int64")
DllCall("ReadProcessMemory", "Uint", hProc, "Uint", dwData, "int64P", hWnd:=0, "Uint", NumGet(btn,12) ? 4:8, "Uint", 0)
If Not hWnd
Continue
WinGet, pid, PID,              ahk_id %hWnd%
WinGet, sProcess, ProcessName, ahk_id %hWnd%
WinGetClass, sClass,           ahk_id %hWnd%
If !sExeName || (sExeName = sProcess) || (sExeName = pid)
VarSetCapacity(sTooltip,128), VarSetCapacity(wTooltip,128*2)
, DllCall("ReadProcessMemory", "Uint", hProc, "Uint", iString, "Uint", &wTooltip, "Uint", 128*2, "Uint", 0)
, DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "str", wTooltip, "int", -1, "str", sTooltip, "int", 128, "Uint", 0, "Uint", 0)
, sTaskButtons .= "idx: " . A_Index-1 . " | idn: " . idn . " | pid: " . pid . " | hWnd: " . hWnd . " | Class: " . sClass . " | Process: " . sProcess . "`n" . "   | Tooltip: " . sTooltip . "`n"
}
DllCall("VirtualFreeEx", "Uint", hProc, "Uint", pProc, "Uint", 0, "Uint", 0x8000)
DllCall("CloseHandle", "Uint", hProc)
Return sTaskButtons
}

HideButton(idn, bHide = True)
{
idxTB := GetTaskSwBar()
SendMessage, 0x404, idn, bHide, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd   ; TB_HIDEBUTTON
}

DeleteButton(idx)
{
idxTB := GetTaskSwBar()
SendMessage, 0x416, idx, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd   ; TB_DELETEBUTTON
}

MoveButton(idxOld, idxNew)
{
idxTB := GetTaskSwBar()
SendMessage, 0x452, idxOld, idxNew, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd    ; TB_MOVEBUTTON
}

GetTaskSwBar()
{
ControlGet, hParent, hWnd,, MSTaskSwWClass1 , ahk_class Shell_TrayWnd
ControlGet, hChild , hWnd,, ToolbarWindow321, ahk_id %hParent%
Loop
{
ControlGet, hWnd, hWnd,, ToolbarWindow32%A_Index%, ahk_class Shell_TrayWnd
If  Not hWnd
Break
Else If hWnd = %hChild%
{
idxTB := A_Index
Break
}
}
Return idxTB
}

129
 :) How about MaxMove?

Press F1 repeatedly to move a window to the next monitor.

Features:
- Moves maximized or restored windows to the same relative position on the other monitor
- Resizes resizable windows to the same relative size on the other monitor

Skrommel

;MaxMove.ahk
; Press a hotkey repeatedly to move a window to the next monitor
;Skrommel @ 2008

#SingleInstance,Force
#NoEnv
SetWinDelay,0

movekey=F1
Hotkey,%movekey%,MOVE
Return


MOVE:
  active:=WinExist("A")
  SysGet,monitors,MonitorCount
  Loop,% monitors
    SysGet,monitor%A_Index%,Monitor,%A_index%

  WinGet,minmax,MinMax,ahk_id %active%
  If minmax=1
    WinRestore,ahk_id %active%
  WinGetPos,resx,resy,resw,resh,ahk_id %active%
  Loop,% monitors
  {
    current:=A_Index
    If (resx+resw/2<monitor%current%Left Or resx+resw/2>monitor%current%Right)
      Continue
    If (resy+resh/2<monitor%current%Top Or resy+resh/2>monitor%current%Bottom)
      Continue
    next:=current+1
    If (next>monitors)
      next:=1
    WinGet,style,Style,ahk_id %active%
    If (style & 0x40000)  ; WS_SIZEBOX=0x40000
      WinMove,ahk_id %active%,,% monitor%next%Left+(resx-monitor%current%Left)/(monitor%current%Right-monitor%current%Left)*(monitor%next%Right-monitor%next%Left),% monitor%next%Top+(resy-monitor%current%Top)/(monitor%current%Bottom-monitor%current%Top)*(monitor%next%Bottom-monitor%next%Top),% resw/(monitor%current%Right-monitor%current%Left)*(monitor%next%Right-monitor%next%Left),% resh/(monitor%current%Bottom-monitor%current%Top)*(monitor%next%Bottom-monitor%next%Top)
    Else     
      WinMove,ahk_id %active%,,% monitor%next%Left+(resx-monitor%current%Left)/(monitor%current%Right-monitor%current%Left)*(monitor%next%Right-monitor%next%Left),% monitor%next%Top+(resy-monitor%current%Top)/(monitor%current%Bottom-monitor%current%Top)*(monitor%next%Bottom-monitor%next%Top)
    If minmax=1
      WinMaximize,ahk_id %active%
    Break
  }
Return

130
 :) Just uploaded GoneIn60s v1.4!

- Added option to ignore classes, closes windows when exiting.

Skrommel

Pages: prev1 ... 21 22 23 24 25 [26] 27 28 29 30 31 ... 187next
Go to full version