 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Did you Try Deskman, and did it work |
| Yes, nice app, i like it (works good) |
|
33% |
[ 2 ] |
| Tried it but deleted it fast (does not work for me) |
|
50% |
[ 3 ] |
| Dont like it |
|
16% |
[ 1 ] |
|
| Total Votes : 6 |
|
| Author |
Message |
holomind
Joined: 11 Mar 2006 Posts: 323 Location: Munich, Germany
|
Posted: Mon Jun 26, 2006 12:31 am Post subject: |
|
|
| Laszlo wrote: | I somehow missed this nice collection of tools. Thanks for sharing it! (I noticed that you closed the ballot, so I cannot cast my vote any more.) There are so much stuff here, it takes hours just to try them out!
|
I didnt close it, it only *expired*, seems to be a *feature* of this forum-software...
| Laszlo wrote: |
Since English keyboards don't have AltGr keys, and left-control with right-alt is just torturing our fingers, the first thing we have to do is re-assign hotkeys. Why don't you list them in the ini file, so there will be less chance to screw up the code?
|
No bad Idea, i'll try to move the key-codes into the ini-file, perhaps this is also a good place to have a mini-documentation for the keys written in small ; comments
| Laszlo wrote: |
Also, the location of IrfanView and 320mph belongs to the ini file.
|
Just added this today, *experimental* as 320mph closes after launch of the app. i use Find+Run-Robot also which keeps in background and launches on hotkey. whats the purpouse of an app-launcher if you have to doubleclick an item ??? also 320mph is written in ahk and doesnt use THIS feature of listening for a hotkey to startup itself
| Laszlo wrote: |
People would experiment with lighter heart if the script saved the layout of all the windows, and at exit everything would be restored.
|
Hmm, all or nothing No serious, you are right, but in my usage i dont restore windows back to some odd sizes. i like to use screen-size efficiently to i dont "resize" windows with the mouse, but completely with ahk/deskman. one main reason i wrote this (there are some apps out there doing similar). To clarify i use windows either in maximized, or half-up/down (regularly) , half left-right (seldom) , and page-size or fullscreen (regularly) when reading e-books or articles.
I think about adding a restore window-size in next version, perhaps its not too bad.
This feature is mostly user-request (also the support for taskbar on every desktop-side, i only use the right version, hmm, at 1024x768 i sometimes use the bottom version also i must admit)
Perhaps i find some time to beautify the code a little bit, as the script is quite large, but as it has many small functions its quite good to maintain.
Thanks for the feedback... |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10667
|
Posted: Mon Jun 26, 2006 3:02 pm Post subject: |
|
|
| I've changed the poll to be indefinite (you can also opt for this when you create a poll). |
|
| Back to top |
|
 |
holomind
Joined: 11 Mar 2006 Posts: 323 Location: Munich, Germany
|
Posted: Thu Aug 03, 2006 7:38 pm Post subject: |
|
|
Live Windows in Sidebar
Experimenting with DLLCalls and PrintWindow i found a way to make screenshots very fast and from offscreen-windows (behind the active one!).
it looks a little bit like DeskMan.ahk but works completely different in background. no external iview.exe needed any more. a little dllcall does the trick. i guess this only works with windows xp. but with vista in the pipeline i dont care too much about the old windows versions.
i didnt find any similar scripts in AHK forum, so hopefully this is helpfull for others how to do realtime screenshots of even offscreen windows (not visible but not minimized)
Compared to the other version in the first post the screenshots are done in realtime which is nearly fast enough (every 2sec refresh) but i will improve this with buffers again, so if nothing changed no screenshots need to be taken. or the user could define which windows to "watch" in realtime.
my idea is to have some windows "active" like a file-copy dialog or a download window, which you put in backgound, but is updated regularly, and you get a glance whats going on. having this minimized window in your taskbar/dock (sidebar).
Have Fun.
I will merge this with the deskman.ahk script sometime.
| Code: |
OnExit, handle_exit
Main:
update_period = 2000
; a new window for the dock
Gui, +AlwaysOnTop -Caption +Owner
;Gui, Color, Red
screenleft := a_ScreenWidth - 103
Gui, Show, w100 h%a_ScreenHeight% x%screenleft% y30, LiveWindows
WinGet, hw_frame, id, LiveWindows
;WinSet, Transcolor, Red, ahk_id %hw_frame%
hdc_frame := GetDC( hw_frame )
; buffer
hdc_buffer := CreateCompatibleDC( hdc_frame )
hbm_buffer := CreateCompatibleBitmap( hdc_frame, a_ScreenWidth , a_ScreenHeight )
SelectObject( hdc_buffer, hbm_buffer )
; once
Gosub, update_dock
; start timer in a loop
SetTimer, update_dock, %update_period%
return
handle_exit:
DeleteObject( h_region )
DeleteObject( hbm_buffer )
DeleteDC( hdc_frame )
DeleteDC( hdc_buffer )
ExitApp
CreateCompatibleDC( p_dc )
{
return, DllCall( "gdi32.dll\CreateCompatibleDC", "uint", p_dc )
}
DeleteDC( p_dc )
{
DllCall( "gdi32.dll\DeleteDC", "uint", p_dc )
}
GetDC( p_hw )
{
return, DllCall( "GetDC", "uint", p_hw )
}
DeleteObject( p_object )
{
DllCall( "gdi32.dll\DeleteObject", "uint", p_object )
}
SelectObject( p_dc, p_bitmap )
{
DllCall( "gdi32.dll\SelectObject", "uint", p_dc, "uint", p_bitmap )
}
CreateCompatibleBitmap( p_dc, p_w, p_h )
{
return, DllCall( "gdi32.dll\CreateCompatibleBitmap", "uint", p_dc, "int", p_w, "int", p_h )
}
CreateRectRgn( p_x1, p_y1, p_x2, p_y2 )
{
return, DllCall( "gdi32.dll\CreateRectRgn", "int", p_x1, "int", p_y1, "int", p_x2, "int", p_y2 )
}
update_dock:
SRCCOPY = 0x00CC0020
; thumbnail size or targetsize for bltcopy
p_w = 100
p_h = 100
p_x = 0
p_y = 0
; offset for each thumbnail
ypos=0
; DEBUG: tooltip, "running" w %p_w% h %p_h% x %p_x% y %p_y%
hw_frame_old =
; Loop through all active windows-tasks (processes)
WinGet, ids, list,,, Program Manager
Loop, %ids%
{
StringTrimRight, task_id, ids%a_index%, 0 ; find the id of this window
; perhaps we dont need all this infos
winGetTitle, title , ahk_id %task_id%
WinGetClass, class , ahk_id %task_id% ;get Class-name
WinGetPos, x, y ,w,h, ahk_id %task_id%
; DEBUG: tooltip , %x% %y% %w% %h% %title%
; DEBUG: sleep, 1000
; for now lets use lazy ignore when window is too small of offscreen or has no title
if (title = "")or (w < 300 ) or (x < 0)
{
;
}
else
{
; find the current task
WinGet, hw_frame1, id, ahk_id %task_id%
; DEBUG: tooltip, "now" ids%a_index% "old" %hw_frame_old% "new" %hw_frame1% "id" %task_id%
; HERE IS THE MAGIC! this makes the screenshot (only works with Windows-XP! or gdiplus.dll)
pwin := DllCall("PrintWindow", "UInt", hw_frame1 ,"UInt", hdc_buffer , "UInt", 0)
; now draw the buffer to the Dock-Window, also scaling and moving offset for thumbnails (no antialize yet)
DllCall( "gdi32.dll\StretchBlt", "uint", hdc_frame, "int", 0, "int", ypos, "int", p_w, "int", p_h, "uint", hdc_buffer, "int", p_x, "int", p_y, "int", 400, "int", 400 ,"uint", SRCCOPY )
; DEBUG: sleep, 100
ypos +=100 ; move down to next thumbnail-position
}
}
; resize the window, so we cut of old stuff, pseudo transparent
WinMove , LiveWindows ,, screenleft, 30, 100 , ypos
; DEBUG: sleep , 1000
; DEBUG: tooltip, "now" %ypos%
return
|
|
|
| Back to top |
|
 |
Guest
|
Posted: Thu Aug 03, 2006 9:00 pm Post subject: |
|
|
| i have xp but the above script didn't do anyhting, how do you work it. it just flashed a gray box on the right side of the screen |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4515 Location: Boulder, CO
|
Posted: Thu Aug 03, 2006 11:46 pm Post subject: |
|
|
It works perfectly in my laptop! Thanks!
Here is a version with some minor cleanup. Set the constants in the beginning to your liking. | Code: | OnExit handle_exit
p_w = 200 ; thumbnail width
p_h = 150 ; height
Left := A_ScreenWidth - p_w
Gui +AlwaysOnTop -Caption +Owner ; window for the dock
Gui Show, w%p_w% h%A_ScreenHeight% x%Left% y0, LiveWindows
WinGet hw_frame, id, LiveWindows
hdc_frame := DllCall("GetDC", UInt, hw_frame)
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame) ; buffer
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,A_ScreenWidth, Int,A_ScreenHeight)
DllCall("gdi32.dll\SelectObject", UInt,hdc_buffer, UInt,hbm_buffer)
SetTimer update_dock, 2000 ; 2 sec update
; flow through 1st call
update_dock:
ypos= 0 ; offset for each thumbnail
WinGet ids, list,,,Program Manager ; all active windows-tasks (processes)
Loop %ids% {
task_id := ids%a_index% ; id of this window
WinGetPos ,,, w, h, ahk_id %task_id%
if (w > 300 and h > 200) { ; small windows not shown
pwin := DllCall("PrintWindow", UInt,task_id, UInt,hdc_buffer, UInt,0)
DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame, Int,0, Int,ypos, Int,p_w, Int,p_h
, UInt,hdc_buffer, Int,0, Int,0, Int,W, Int,H ,UInt,0xCC0020) ; SRCCOPY
ypos += p_h ; move down to next thumbnail-position
}
}
WinMove LiveWindows,,Left, 0,,ypos
Return
handle_exit:
DllCall("gdi32.dll\DeleteObject", UInt,h_region )
DllCall("gdi32.dll\DeleteObject", UInt,hbm_buffer)
DllCall("gdi32.dll\DeleteDC", UInt,hdc_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdc_buffer)
ExitApp |
Last edited by Laszlo on Fri Aug 04, 2006 11:29 pm; edited 1 time in total |
|
| Back to top |
|
 |
d-man
Joined: 08 Jun 2006 Posts: 275
|
Posted: Fri Aug 04, 2006 3:44 am Post subject: |
|
|
Thanks these are really cool!
Would it be possible to use this to view what another computer is doing on a home network? Like maybe save the pictures on one and load them on another? just curious. |
|
| Back to top |
|
 |
holomind
Joined: 11 Mar 2006 Posts: 323 Location: Munich, Germany
|
Posted: Fri Aug 04, 2006 4:57 am Post subject: |
|
|
Hi Lazlo, nice to see how to optimize the AHK script with
usage of defaults etc. i learn a lot with this example.
i have made a little modification so the windows are antialized (but a little bit slower) in general this could be speeded much, when the thumbnails are buffered, and/or the user would choose which window to "watch".
like in the deskman.ahk, one could make a list of the available windows and watch for changed "window title". like filedownload change like "15% of xy.." (dynamic title).
but this is more a proof of concept to use Dllcall and PrintWindow in a cool way.
this is added for halftone:
| Code: |
DllCall( "gdi32.dll\SetStretchBltMode", "uint", hdc_frame, "int", 4 )
; Halftone better quality with stretch
|
Modified version:
| Code: |
OnExit handle_exit
p_w = 200 ; thumbnail width
p_h = 150 ; height
Left := A_ScreenWidth - p_w
Gui +AlwaysOnTop -Caption +Owner ; window for the dock
Gui Show, w%p_w% h%A_ScreenHeight% x%Left% y0, LiveWindows
WinGet hw_frame, id, LiveWindows
hdc_frame := DllCall( "GetDC", UInt, hw_frame )
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame) ; buffer
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,A_ScreenWidth, Int,A_ScreenHeight)
DllCall( "gdi32.dll\SelectObject", UInt,hdc_buffer, UInt,hbm_buffer)
SetTimer update_dock, 2000 ; 2 sec update
; flow through 1st call
update_dock:
ypos= 0 ; offset for each thumbnail
WinGet ids, list,,,Program Manager ; all active windows-tasks (processes)
Loop %ids% {
task_id := ids%a_index% ; id of this window
WinGetPos ,,, w, h, ahk_id %task_id%
if (w > 300 and h > 200) { ; small windows not shown
pwin := DllCall("PrintWindow", UInt,task_id, UInt,hdc_buffer, UInt,0)
DllCall( "gdi32.dll\SetStretchBltMode", "uint", hdc_frame, "int", 4 )
; Halftone better quality with stretch
DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame, Int,0, Int,ypos, Int,p_w, Int,p_h
, UInt,hdc_buffer, Int,0, Int,0, Int,W, Int,H ,UInt,0xCC0020) ; SRCCOPY
ypos += p_h ; move down to next thumbnail-position
}
}
WinMove LiveWindows,,Left, 0,,ypos
Return
handle_exit:
DllCall("gdi32.dll\DeleteObject", UInt,h_region )
DllCall("gdi32.dll\DeleteObject", UInt,hbm_buffer)
DllCall("gdi32.dll\DeleteDC", UInt,hdc_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdc_buffer)
ExitApp
|
Update: Bugfix of Lazlo applied, now without W,H.
Last edited by holomind on Sat Aug 05, 2006 1:52 am; edited 1 time in total |
|
| Back to top |
|
 |
holomind
Joined: 11 Mar 2006 Posts: 323 Location: Munich, Germany
|
Posted: Fri Aug 04, 2006 5:04 am Post subject: |
|
|
| d-man wrote: | Thanks these are really cool!
Would it be possible to use this to view what another computer is doing on a home network? Like maybe save the pictures on one and load them on another? just curious. |
one solution would be to make a screenshot of the dock-gui-window (like used in deskman.ahk you even can set the compessionlevel for the .jpg in iview command) and then save this in a shared network-folder instead of the windows-temp. then have another programm updating and showing this picture in a regular interval. perhaps irfanview can detect and update the changes. or you use a little other script to load the screenshot at a regular interval. i saw a *prankster* script here in the forum, so show a message on a remote computer over the network.
see also : http://www.autohotkey.com/forum/topic8413.html |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4515 Location: Boulder, CO
|
Posted: Fri Aug 04, 2006 11:28 pm Post subject: |
|
|
True, the half-tone version looks nicer! Btw, there was a little error in the streamlined version: | Code: | W = 800 ; Top left part of window to copy
H = 600 ; Width, Height | These two lines have no effects, because the actual window size (w,h of "WinGetPos ,,, w, h, ahk_id %task_id%") is used. Just remove those two lines. |
|
| Back to top |
|
 |
holomind
Joined: 11 Mar 2006 Posts: 323 Location: Munich, Germany
|
Posted: Sat Aug 05, 2006 2:15 am Post subject: |
|
|
| Laszlo wrote: | True, the half-tone version looks nicer! Btw, there was a little error in the streamlined version: | Code: | W = 800 ; Top left part of window to copy
H = 600 ; Width, Height | These two lines have no effects, because the actual window size (w,h of "WinGetPos ,,, w, h, ahk_id %task_id%") is used. Just remove those two lines. |
I updated my post to apply your changes.
In my experience the usage of PrintWindow ist not *perfect* as it has effects on the printed Windows (The source window, not the dock). For example browsing with internet explorer (6) it has problems with smooth scrolling, as the frequent call of PrintWindow interferes with rendering the page. Perhaps scrolling the page calls a re-render of the page and PrintWindow calls a new re-render when the render from scrolling is not finished yet. also sometimes there are black regions in the thumbnail, but this is a *bug* of printwindow, there are many commercial tools which have similar problem (eg. topdesk). also sometimes the source window (your normal windows) dont get redrawn at all until you resize it. this effects do not appear at all with iview.exe image capture (which reads the desktop/screen and not the window itself).
The advantage of printwindow is, that you can screenshot "invisible/behind the active" windows. which makes it perfect for just watching an window as a live-preview.
(this could be a nice new ahk script, pressing a hotkey opens a new thumnail window with always on top visibility then rendering the active window in regular intervals eg. 5seconds, now you can do other stuff and have your thumbnail always in your view, would be perfect for a *konfabulator/gadget/widget* in the sidebar. and watch the window which is now in the background. perhaps i start a new forum-thread with this idea when i figure out how to do it. (should be possible with 20 lines of ahk-script)
would be similar to (but not as fast):
http://www.winplosion.com/windowgrabber/
...
playing a little with the script i found reading directly from the DC (graphic device context) one can make a screenshot of the desktop quite easily without iview.exe. by simply using BltBit/StrechBlt to copy the pixels from one DC (eg. window) to the other window. i dont know how to save the image then, but if you simply render it in your gui it should be faster than calling external iview.exe. As it is a CreateCompatibleBitmap (=Bitmap =BMP?) it should be easy to save it as a .bmp file. this way one could have a easy print-screen function (without using pscr-key) in ahk. I dont need it right now, put perhaps somebody might use this idea.
something like (perhaps not working code)
| Code: |
WinGet hw_frame, id, LiveWindows
hdc_frame := DllCall( "GetDC", UInt, hw_frame )
WinGet hw_frame2, id, Desktop ; << needs right ahk_class here!
hdc_frame2 := DllCall( "GetDC", UInt, hw_frame2 )
DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame2, Int,0, Int,ypos, Int,p_w, Int,p_h
, UInt,hdc_frame, Int,0, Int,0, Int,W, Int,H ,UInt,0xCC0020) ; SRCCOPY
|
I try to post a working example, when i remember how i did it  |
|
| Back to top |
|
 |
d-man
Joined: 08 Jun 2006 Posts: 275
|
Posted: Sat Aug 05, 2006 3:12 am Post subject: |
|
|
| that would be uber cool iif u could do it (save screenshot w/ no extgernal program). maybe the binary load/save cna help? i don't know enough. |
|
| Back to top |
|
 |
holomind
Joined: 11 Mar 2006 Posts: 323 Location: Munich, Germany
|
Posted: Sat Aug 05, 2006 2:05 pm Post subject: |
|
|
| d-man wrote: | | that would be uber cool iif u could do it (save screenshot w/ no extgernal program). maybe the binary load/save cna help? i don't know enough. |
i'll try to combine it with
http://www.autohotkey.com/forum/viewtopic.php?t=11063
which should have the solution for saving the image.
reading the screen pixel by pixel should really be very slow.
using bitblt is much better for this. |
|
| Back to top |
|
 |
holomind
Joined: 11 Mar 2006 Posts: 323 Location: Munich, Germany
|
Posted: Thu Aug 10, 2006 4:16 am Post subject: |
|
|
This Version is a bugfix release for the new AHK-Version (August 2006 ?) . There are some Changes in AHK which broke my script. so i had to make minor changes.
Now the Hotkey-Definitions are at the beginning of the file and can be changed easier. (still some configs at the end of file READINI: ).
Temporary-Folder is now in the scriptdirectory so you can see what DeskMan does. Thumbnails are in DeskManTemp instead of %System%/Temp.
The Titles are now added to the thumbnails (also correct now with taskbar on bottom).
Not yet combined with LiveWindows. Perhaps in Future as DllCall "PrintWindow" has some Advantages compared to iView. No external App needed. (reduces filesize very much 600Kb => 200kb!) Windows in Background could be updated in realtime (every second). |
|
| Back to top |
|
 |
holomind
Joined: 11 Mar 2006 Posts: 323 Location: Munich, Germany
|
Posted: Thu Aug 10, 2006 4:23 am Post subject: |
|
|
| d-man wrote: | | that would be uber cool iif u could do it (save screenshot w/ no extgernal program). maybe the binary load/save cna help? i don't know enough. |
I did some experiments, but gave up as there is no easy way to save a DC into a Bitmap. I dont understand too much of VisualBasic to do it. But there are some Examples in c# or VB to save an DC to BMP or many other formats.
you have to create an image " image = new Image". and copy the DC to the image. then you can call "Image.save xy.bmp". or you create a picturebox and then also can save this into a file. but many scripts are quite complicated.
my experiments so far, copying the screenshot/desktop to another DC.
at least you can display the screenshot in your own application but cant save it to a file. you even can keep the screenshot in memory with the
hdmbuffer. and resize/scale it with StrechBlt.
| Code: |
OnExit handle_exit
Gui, 1: +AlwaysOnTop +Owner +Resize +ToolWindow ; window for the dock
Gui, 1:Show, NoActivate w400 h400 x800 y50 , PrintScreen
WinGet PrintScreenID, id ,PrintScreen ;
;retrieve the unique ID number (HWND/handle) of that window
WinGet, PrintSourceID, id
tooltip, %PrintSourceID%
hdd_frame := DllCall( "GetDC", UInt, PrintSourceID )
hdc_frame := DllCall( "GetDC", UInt, PrintScreenID )
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame) ; buffer
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,A_ScreenWidth, Int,A_ScreenHeight)
DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame, Int,33, Int,0, Int,400, Int,400
, UInt,hdd_frame, Int, 0, Int,22, Int,400, Int,400 ,UInt,0xCC0020) ; SRCCOPY
return
GuiClose:
handle_exit:
DllCall("gdi32.dll\DeleteObject", UInt,h_region )
DllCall("gdi32.dll\DeleteObject", UInt,hbm_buffer)
DllCall("gdi32.dll\DeleteDC", UInt,hdc_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdc_buffer)
ExitApp
|
|
|
| Back to top |
|
 |
holomind
Joined: 11 Mar 2006 Posts: 323 Location: Munich, Germany
|
Posted: Fri Sep 08, 2006 12:50 pm Post subject: |
|
|
Deskman now supports Gestures,
now you can move your windows to positions with your mouse
right.
Gesture with right mouseclick: (move 50px)
R=Move to Right
U=Move to Up
D=Move to Down
L=Move to Left
UU= Move to UP 2x50 pixels
Functions:
UU = Maximize
DD = F10 (opens expose in my case)
L = Prev Task
R = Next Task
U = Halfup
D = HalfDown
UL = Upperleft window quartersize
UR = Upperright window quartersize
DL = Lowerleft window quartersize
DR = Lowerright window quartersize
LLL = close active window
UUU = Reload this script
Gesture script is from this forum, i removed a lot things so it does not interfere with deskman |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|