Jump to content

Screenshot Win10 desktop, quick access, device manager, and start menu.


Recommended Posts

SCREENSHOT WIN10 DESKTOP, QUICK ACCESS, DEVICE MANAGER (both selected items and everything) AND START MENU WITHOUT INTERACTION.
MULTIPLE SHOTS JOINED STACKED, SIDE-BY-SIDE, OR NEITHER.  THIS SCRIPT MUST BE RUN IN A WINDOW WITH ADMIN PRIVILEGES!  YOU WILL NOT BE ABLE TO MAXIMIZE THE DEVICE MANAGER UNLESS THE DEVICE MANAGER IS OPENED BY A COMMAND RUNNING WITH ADMIN PRIVILEGES.  THE SCRIPT WILL BREAK AT THE DEVICE MANAGER IF THE DEVICE MANAGER IS NOT MAXIMIZED.

 

; SCREENSHOT WIN10 DESKTOP, QUICK ACCESS, DEVICE MANAGER (both selected items and everything) AND START MENU.
; THIS SCRIPT MUST BE RUN IN A WINDOW WITH ADMIN PRIVILEGES.
; BLANK START MENU ICONS RESTORED BY TOGGLING "USE START MENU FULL SCREEN" TWICE.
; BLANK START MENU ICONS SEEM TO BE LESS OF A PROBLEM SINCE WINDOWS 10 Version 1903 (10.0.18362.388) WAS RELEASED.
; MULTIPLE SHOTS JOINED STACKED, SIDE-BY-SIDE, OR NEITHER.
; YOU WILL NOT BE ABLE TO MAXIMIZE THE DEVICE MANAGER UNLESS THE DEVICE MANAGER IS OPENED BY A SCRIPT RUNNING WITH ADMIN PRIVILEGES.
; "C:\Program Files (x86)\AutoIt3\AutoIt3_x64.exe" "F:\MYAPPS\WINDOWS\screenshots1.au3"
;;
;;  MICROSOFT WINDOWS v.1903 [Version 10.0.18362.418] PRO 64-BIT
;;  AUTOIT3 v3.3.14.5 SCRIPT
;;  PURPOSE:
; WRITE AN AUTOIT3 SCRIPT THAT WHEN RUN IN A WINDOWS SCHEDULED TASK WILL PRODUCE SCREENSHOTS OF THE WINDOWS 10 DESKTOP, START MENU, QUICK ACCESS MENU, AND DEVICE MANAGER WITHOUT INTERACTION.
;;  SEE https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/
;;  "IF THIS SCRIPT IS CALLED BY A BATCH FILE WHOSE OUTPUT IS BEING RE-DIRECTED THE BATCH MUST BE STARTED WITH: CMD /C BATCHFILE.BAT "

;  BEGIN How to get 4 Screen Coordinates just by dragging a Rectangle.  Drag out box not displayed on context menus or the start menu.
;  download Coordinates.au3   https://www.autoitscript.com/forum/topic/165325-how-to-get-4-screen-coordinates-just-by-dragging-a-rectangle/
;     END How to get 4 Screen Coordinates just by dragging a Rectangle

;  BEGIN CAPTURE
; https://www.autoitscript.com/forum/topic/8377-capture-screen-dll/
; Capture full screen
; First parameter - filename, last - jpeg quality.

#RequireAdmin
#include <ScreenCapture.au3>


; BEGIN THE FOLLOWING REQUIRED TO SHOOT THE ENTIRE DEVICE MANAGER IN ONE SHOT
; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin//?do=findComment&comment=1407181
; credit for the screenshot scrolling code goes to monoscout999
#include <ScrollBarsConstants.au3>
#include <WindowsConstants.au3>
#include <process.au3>
#include <GuiTreeView.au3>
#include <GuiScrollBars.au3>
#include <WinAPISysWin.au3>
;     END THE FOLLOWING REQUIRED TO SHOOT THE ENTIRE DEVICE MANAGER IN ONE SHOT

;; BEGIN JOIN IMAGES
#include <GDIPlus.au3>
; #include <WinAPISysWin.au3>
;;    END JOIN IMAGES

; BETTER RESULTS IF AT LEASE ONE EXPLORER WINDOW IS OPEN
Run("explorer.exe", "", @SW_SHOWMINIMIZED)
; Run( @comspec & " /c start explorer.exe","", @SW_SHOWMINIMIZED)
; Run( @comspec & " /c start explorer.exe","", @SW_HIDE)
; $Path = "F:\Users\Default\Desktop\UPDATE"
; Run("C:\WINDOWS\EXPLORER.EXE /n,/e," & $Path, "", @SW_SHOWMINIMIZED)
WinWait("My Computer")
Sleep(500)
; WinActivate("My Computer")
; WinSetState("My Computer", "", @SW_MAXIMIZE)

_ScreenCapture_SetJPGQuality(75)

; wake the monitor, show the desktop, wait X milliseconds
; Send(" ")
Send("#d")
Sleep(500)

; DESKTOP
MouseMove(1360, 0) ; move mouse off the start menu
$ZDIR = @HomeDrive & "\Users\Default\Desktop\UPDATE\" & @UserName & "\SCREENSHOTS" ;where does the screenshot go
$ZNAME = "\desktop.jpg" ;what will its name be
$ZTOPX = 0
$ZTOPY = 0
$ZBOTTOMX = -1
$ZBOTTOMY = -1
Sleep(1000)
ScreenShot()
Sleep(1000)

; exit


; DEVICE MANAGER
;  YOU WILL NOT BE ABLE TO MAXIMIZE THE DEVICE MANAGER UNLESS THE DEVICE MANAGER IS OPENED BY A SCRIPT RUNNING WITH ADMIN PRIVILEGES.
;  THIS SCRIPT MUST BE RUN AS AN ADMINISTRATOR.
;  THE SCRIPT BREAKS HERE IF THE DEVICE MANAGER IS NOT MAXIMIZED
; a selection of items in the device manager

; BEGIN OPEN DEVICE MANAGER MAXIMIZED
; NONE OF THESE COMMANDS WILL WORK UNLESS THIS SCRIPT IS BEING RUN W/ ADMIN PRIVILEGES
; Device Manager MMCMainFrame SysTreeView32
; CHOOSE YOUR POISON
; Run( @comspec & " /c start devmgmt.msc","", @SW_HIDE)
; WinWait("Device Manager")
; WinActivate("Device Manager")
; WinSetState("Device Manager", "", @SW_MAXIMIZE)
; ShellExecute('devmgmt.msc',"","","",@SW_MAXIMIZE)
; Run(@ComSpec & " /c " & 'devmgmt.msc', "", @SW_HIDE)
; Run( @comspec & " /c start devmgmt.msc","", @SW_HIDE)
; WinWait("Device Manager")
; WinActivate("Device Manager")
; WinSetState("Device Manager", "", @SW_MAXIMIZE)
; Sleep( 500 )
; send("{LWIN+UP}") ; MAXIMIZE WINDOW
; run("control /name Microsoft.DeviceManager") ; can't interact with this one unless admin
; WinWaitActive("Device Manager")
; $WinHndl = WinGetHandle("Device Manager")
; WinMove($WinHndl,"",-5,0,@DeskTopWidth,@DeskTopHeight) ; might need to tweak the -5
;    END OPEN DEVICE MANAGER MAXIMIZED
MouseMove(1360, 0) ; move mouse off the device manager
ShellExecute('devmgmt.msc', "", "", "", "")
WinWaitActive("Device Manager")
WinSetState("Device Manager", "", @SW_MAXIMIZE)
$ZDIR = @TempDir ;where does the screenshot go
$ZNAME = "\device-manager1.jpg" ;what will its name be
$ZTOPX = 4 ; 20" 1360 X 768
$ZTOPY = 80 ; 20" 1360 X 768
$ZBOTTOMX = 378 ; 20" 1360 X 768
$ZBOTTOMY = 617 ; 20" 1360 X 768
AutoItSetOption("SendKeyDelay", "125") ; was 55, 500,1000, 750, 250, 125
Send("{tab}{down}{right}") ; AUDIO IN AND OUT
Send("{down 6}{right}") ; DISK DRIVES.
Send("{down 3}{right}") ; DISPLAY ADAPTERS
Send("{down 5}{right}") ; IDE ATA/ATAPI CONTROLLERS

; am i online? check online online command / offline command
; BEGIN https://www.autoitscript.com/forum/topic/1353-check-if-a-computer-is-online/
$Computer = "8.8.8.8"
If RunWait("ping.exe -n 1 " & $Computer, "", @SW_HIDE) == 0 Then
    Send("{down 5}{right}{down 11}") ; online.  NETWORK ADAPTERS.  TAKE THE HIGHLIGHT OFF.
Else
    Send("{down 6}{right}{down 10}") ; offline. NETWORK ADAPTERS.  TAKE THE HIGHLIGHT OFF.
EndIf
;   END https://www.autoitscript.com/forum/topic/1353-check-if-a-computer-is-online/

ScreenShot()
; Msgbox(0,"Operation halted","Continue?") ; PAUSE FOR DEBUG
$ZDIR = @TempDir ;where does the screenshot go
$ZNAME = "\device-manager2.jpg" ; what will its name be.
$ZTOPX = 4 ; 20" 1360 X 768
$ZTOPY = 564 ; 20" 1360 X 768
$ZBOTTOMX = 378 ; 20" 1360 X 768
$ZBOTTOMY = 672 ; 20" 1360 X 768
Send("{down 5}{right}{down 6}") ; SOUND, VIDEO, AND GAME CONTROLLERS.  TAKE THE HIGHLIGHT OFF.
ScreenShot()
; Msgbox(0,"Operation halted","Continue?") ; PAUSE FOR DEBUG
_BMPJoin(@TempDir & "\device-manager1.jpg", @TempDir & "\device-manager2.jpg", @HomeDrive & "\Users\Default\Desktop\UPDATE\" & @UserName & "\SCREENSHOTS\device-manager.jpg", "")

; exit


; DEVICE MANAGER 2
; screenshot of everything in the device manager
; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin//?do=findComment&comment=1407181
; credit for the screenshot scrolling code goes to monoscout999
WinActivate("Device Manager")
Sleep(1000)
$outputFile = @HomeDrive & "\Users\Default\Desktop\UPDATE\" & @UserName & "\SCREENSHOTS\device-manager2.jpg"
;get a handle of things
$WinHndl = WinGetHandle("Device Manager")
$Treeview = ControlGetHandle("Device Manager", "", "[Class:SysTreeView32]")
;expand the treeview control
_GUICtrlTreeView_Expand($Treeview) 
Sleep(1000)
MouseMove(300, 200)
MouseWheel("up", 100)
Sleep(1000)
;Get Edit1 Vertical Scroll Min/Max range and page size.
$aScrollRange = _GUIScrollBars_GetScrollRange($Treeview, $SB_VERT)
$iPageSize = _GUIScrollBars_GetScrollInfoPage($Treeview, $SB_VERT)
$iPages = Round($aScrollRange[1] / $iPageSize)
;get treeview control size
$aTreeviewPos = ControlGetPos($WinHndl, "", $Treeview)
;Capture
$scrollBarSize = 20
$hDC = _WinAPI_GetDC($Treeview)
$hCDC = _WinAPI_CreateCompatibleDC($hDC)
$hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $aTreeviewPos[2] - $scrollBarSize, ($aTreeviewPos[3] * ($iPages + 1)))
_WinAPI_SelectObject($hCDC, $hBMP)
For $i = 0 To $iPages + 1
    _WinAPI_BitBlt($hCDC, 0, $aTreeviewPos[3] * $i, $aTreeviewPos[2] - $scrollBarSize, ($aTreeviewPos[3]), $hDC, 0, 0, $SRCCOPY)
    _WinAPI_PostMessage($Treeview, $WM_VSCROLL, $SB_PAGEDOWN, 0)
    Sleep(250)
Next
_WinAPI_ReleaseDC($Treeview, $hDC)
_WinAPI_DeleteDC($hCDC)
_GDIPlus_Startup()
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
_GDIPlus_ImageSaveToFile($hImage, $outputFile)
_GDIPlus_Shutdown()
_WinAPI_DeleteObject($hBMP)
; If FileExists($outputFile) Then ShellExecute($outputFile)

; ProcessClose ( "mmc.exe" ) ; close the device manager.  THIS MIGHT BE WEAK.
WinClose("[CLASS:MMCMainFrame]", "")

;exit



; QUICK ACCESS
; Sleep(750)
; https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm
MouseClick("right", 74, 748, 1, 0) ; 20". 1360 X 768. right click windows explorer shortcut on taskbar to open context menu
Sleep(2500) ; doubled the sleep time on 052119
Send("{up}") ; remove the highlight box around the top item
$ZDIR = @TempDir ; where does the screenshot go?
$ZNAME = "\quick-access2.jpg" ; what will its name be?
; $ZNAME="\quick-access.jpg" ; what will its name be?
; $ZTOPX=0 ; 32". 1980 X 768
; $ZTOPY=188 ; 32". 1980 X 768
; $ZBOTTOMX=255 ; 32". 1980 X 768
; $ZBOTTOMY=870 ; 32". 1980 X 768
$ZTOPX = 0 ; 20". 1360 X 768
$ZTOPY = 40 ; 20". 1360 X 768
$ZBOTTOMX = 250 ; 20". 1360 X 768
$ZBOTTOMY = 108 ; 20". 1360 X 768
Sleep(750)
ScreenShot()
AutoItSetOption("SendKeyDelay", "250")
Send("{up 3}{pgdn}{down}") ; expose the most pinned items
$ZDIR = @TempDir ; where does the screenshot go?
$ZNAME = "\quick-access1.jpg" ; what will its name be?
$ZTOPX = 0
$ZTOPY = 0
$ZBOTTOMX = 250
$ZBOTTOMY = 615
; Sleep(500)
ScreenShot()
; MouseClick("left", 74, 748, 1, 0) ; left click windows explorer shortcut on taskbar to close context menu ; 20". 1360 X 768
WinClose("[CLASS:CabinetWClass]", "")
_BMPJoin(@TempDir & "\quick-access2.jpg", @TempDir & "\quick-access1.jpg", @HomeDrive & "\Users\Default\Desktop\UPDATE\" & @UserName & "\SCREENSHOTS\quick-access.jpg", "")

; exit

Sleep(1000)


; START MENU
; begin restore blank icons on start menu
Run(@ComSpec & " /c start ms-settings:personalization-start", "", @SW_SHOWMINIMIZED)
Sleep(500)
WinWaitActive("Settings")
Sleep(1000)
; WinWaitActive ("[CLASS:ApplicationFrameInputSinkWindow]", "")
;
; BEGIN https://www.autoitscript.com/forum/topic/1353-check-if-a-computer-is-online/
$Computer = "8.8.8.8"
AutoItSetOption ("SendKeyDelay" , "125") ;was 55, 500
If RunWait("ping.exe -n 1 " & $Computer, "", @SW_HIDE) == 0 Then
    WinActivate("Settings")
    send("{tab}{down 5}{tab 6}")
    sleep(500)
    send("{space}{tab 10}") ; if online. Move to "use start full screen", toggle it and (improves reliability) return cursor to "find a setting" search box.
Else
    WinActivate("Settings")
    send("{tab}{down 5}{tab 6}")
    sleep(500)
    send("{space}{tab 6}") ; if offline. Move to "use start full screen", toggle it and (improves reliability) return cursor to "find a setting" search box.
EndIf
;   END https://www.autoitscript.com/forum/topic/1353-check-if-a-computer-is-online/
;
; MouseClick("left", 379, 490, 1, 0) ; Toggle "use start full screen".  Autoitv3 Window Info MouseClick Coords are 23px north.  If y=467 use y=490
Sleep(500)
; Msgbox(0,"Operation halted","Continue?") ; PAUSE FOR DEBUG
; WinClose("[CLASS:ApplicationFrameWindow]", "")
; Send("{LWIN 2}") ; OPEN AND CLOSE THE START MENU 
Send("{LWIN}") ; OPEN START MENU
sleep(500)
Send("{LWIN}") ; CLOSE START MENU
Sleep(1000)
; Run(@ComSpec & " /c start ms-settings:personalization-start", "", @SW_SHOWMINIMIZED)
; Sleep(500)
; WinWaitActive ("Settings")
; WinWaitActive ("[CLASS:ApplicationFrameInputSinkWindow]", "")
;
; BEGIN https://www.autoitscript.com/forum/topic/1353-check-if-a-computer-is-online/
$Computer = "8.8.8.8"
AutoItSetOption ("SendKeyDelay" , "125") ;was 125, 55, 500
If RunWait("ping.exe -n 1 " & $Computer, "", @SW_HIDE) == 0 Then
    WinActivate("Settings")
    sleep(500)
    send("{tab 7}") ; if online. Move to "use start full screen", 
    sleep(500)
    send("{space}{tab 10}") ; if online. Toggle "use start full screen" and (improves reliability) return cursor to "find a setting" search box.
Else
    WinActivate("Settings")
    sleep(500)
    send("{tab 7}") ; if offline. Move to "use start full screen", 
    sleep(500)
    send("{space}{tab 6}") ; if offline. Toggle "use start full screen" and (improves reliability) return cursor to "find a setting" search box.
EndIf
;   END https://www.autoitscript.com/forum/topic/1353-check-if-a-computer-is-online/
;
; MouseClick("left", 379, 490, 1, 0) ; Toggle "use start full screen".  Autoitv3 Window Info MouseClick Coords are 23px north.  If y=467 use y=490
Sleep(500)
; Msgbox(0,"Operation halted","Continue?") ; PAUSE FOR DEBUG
WinClose("[CLASS:ApplicationFrameWindow]", "")
;   end restore blank icons on start menu

Sleep(1000)

; screenshot start menu 
MouseMove(1305, 0) ; move mouse off the start menu
Send("{LWIN}") ; OPEN START MENU
$ZDIR = @TempDir ; where does the screenshot go?
$ZNAME = "\start-menu1.jpg" ; what will its name be?
; $ZTOPX=87 ; 32". 1980 X 768
; $ZTOPY=106 ; 32". 1980 X 768
; $ZBOTTOMX=1191 ; 32". 1980 X 768
; $ZBOTTOMY=873 ; 32". 1980 X 768
$ZTOPX = 56 ;  20". 1360 X 768
$ZTOPY = 56 ;  20". 1360 X 768
$ZBOTTOMX = 1303 ;  20". 1360 X 768
$ZBOTTOMY = 694 ;  20". 1360 X 768
; Sleep( 1500 )
AutoItSetOption("SendKeyDelay", "1000")
Send("{tab 3}")
ScreenShot()
; Sleep( 1000 )
AutoItSetOption("SendKeyDelay", "250")
; AutoItSetOption("SendKeyDelay", "600")
Send("{down 11}")
Send("{tab}")
$ZDIR = @TempDir ; where does the screenshot go?
$ZNAME = "\start-menu2.jpg" ; what will its name be?
; $ZTOPX=87 ; 32". 1980 X 768
; $ZTOPY=210 ; 32". 1980 X 768
; $ZBOTTOMX=1190 ; 32". 1980 X 768
; $ZBOTTOMY=987 ; 32". 1980 X 768
$ZTOPX = 56 ;  20". 1360 X 768
$ZTOPY = 83 ;  20". 1360 X 768
$ZBOTTOMX = 1303 ;  20". 1360 X 768
$ZBOTTOMY = 724 ;  20". 1360 X 768
; Sleep( 1000 )
ScreenShot()
; Sleep( 500 )
Send("{down 12}")
; Sleep( 500 )
Send("{tab}") ; TAKE THE HIGHLIGHT OFF EVERYTHING
;                   END WEAK POINT
$ZDIR = @TempDir ; where does the screenshot go?
$ZNAME = "\start-menu3.jpg" ; what will its name be?
; $ZTOPX=87 ; 32". 1980 X 768
; $ZTOPY=210 ; 32". 1980 X 768
; $ZBOTTOMX=1190 ; 32". 1980 X 768
; $ZBOTTOMY=987 ; 32". 1980 X 768
$ZTOPX = 56 ;  20". 1360 X 768
$ZTOPY = 596 ;  20". 1360 X 768
$ZBOTTOMX = 1303 ;  20". 1360 X 768
$ZBOTTOMY = 730 ;  20". 1360 X 768
Sleep(1000)
ScreenShot()
Sleep(500)
Send("{LWIN}") ; CLOSE THE START MENU
Sleep(500)
_BMPJoin(@TempDir & "\start-menu1.jpg", @TempDir & "\start-menu2.jpg", @TempDir & "\start-menu4.jpg", "")
_BMPJoin(@TempDir & "\start-menu4.jpg", @TempDir & "\start-menu3.jpg", @HomeDrive & "\Users\Default\Desktop\UPDATE\" & @UserName & "\SCREENSHOTS\start-menu.jpg", "")
MouseMove(650, 350)



;WinActivate("Administrator:  press any key to continue. screenshots finished.") ; restore CMD from taskbar

;;     END CAPTURE

Exit  ; END OF SCRIPT


;; BEGIN SCREENSHOT FUNCTION
Func ScreenShot()
    ; Capture full screen
    _ScreenCapture_Capture($ZDIR & $ZNAME, $ZTOPX, $ZTOPY, $ZBOTTOMX, $ZBOTTOMY)
EndFunc   ;==>ScreenShot

; https://www.autoitscript.com/autoit3/docs/libfunctions/_ScreenCapture_Capture.htm
; $iLeft [optional] X coordinate of the upper left corner of the rectangle
; $iTop [optional] Y coordinate of the upper left corner of the rectangle
; $iRight [optional] X coordinate of the lower right corner of the rectangle. If this is -1, the current screen width will be used.
; $iBottom [optional] Y coordinate of the lower right corner of the rectangle. If this is -1, the current screen height will be used.

;;    END SCREENSHOT FUNCTION

;; BEGIN JOIN IMAGES FUNCTION
; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/
Func _BMPJoin($sFile1, $sFile2, $sResult, $Position)
    Local $hSourceIMG1, $hSourceIMG2, $iWidth1, $width2, $iHeight1, $iHeight2, $hBitmap, $hImage, $hGraphics
    Local $iBwidth, $iBheight

    If Not FileExists(StringRegExpReplace($sResult, "(^.*)\\.*", "\1")) Then $sResult = @ScriptDir & "\result.bmp"

    _GDIPlus_Startup()

    $hSourceIMG1 = _GDIPlus_ImageLoadFromFile($sFile1)
    $hSourceIMG2 = _GDIPlus_ImageLoadFromFile($sFile2)
    $iWidth1 = _GDIPlus_ImageGetWidth($hSourceIMG1)
    $iHeight1 = _GDIPlus_ImageGetHeight($hSourceIMG1)
    $iWidth2 = _GDIPlus_ImageGetWidth($hSourceIMG2)
    $iHeight2 = _GDIPlus_ImageGetHeight($hSourceIMG2)

    If $Position = "right" Then
        $iBwidth = $iWidth1 + $iWidth2
        $iBheight = $iHeight1
        If $iHeight2 > $iHeight1 Then $iBheight = $iHeight2 ; WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SIZE HEIGHT AND ARE BEING DISPLAYED SIDE-BY-SIDE.
    Else ;position = "below"
        $iBwidth = $iWidth1
        If $iWidth2 > $iWidth1 Then $iBwidth = $iWidth2
        $iBheight = $iHeight1 + $iHeight2
    EndIf


    $hBitmap = _CreateBMP($iBwidth, $iBheight)
    $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

    $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)

    ; https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_GraphicsDrawImageRectRect.htm
    _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG1, 0, 0, $iWidth1, $iHeight1, 0, 0, $iWidth1, $iHeight1)
    If $Position = "right" Then
        _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG2, 0, 0, $iWidth2, $iHeight2, $iWidth1, 0, $iWidth2, $iHeight2)
    Else
        _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG2, 0, 0, $iWidth2, $iHeight2, 0, $iHeight1, $iWidth2, $iHeight2)
        
    EndIf

    _GDIPlus_ImageSaveToFile($hImage, $sResult)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteObject($hImage)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_ImageDispose($hSourceIMG1)
    _GDIPlus_ImageDispose($hSourceIMG2)
    _GDIPlus_Shutdown()
EndFunc   ;==>_BMPJoin

Func _CreateBMP($sWidth, $sHeight)
    Local $hWnd, $hDC, $hBMP

    $hWnd = _WinAPI_GetDesktopWindow()
    $hDC = _WinAPI_GetDC($hWnd)
    $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $sWidth, $sHeight)
    _WinAPI_ReleaseDC($hWnd, $hDC)

    Return $hBMP
EndFunc   ;==>_CreateBMP

;;   END JOIN IMAGES FUNCTION

 

 

device-manager.jpg.d4bdcd4ea1a4e09039c5705dd86524ed.jpgdesktop.thumb.jpg.a7a469fb9ccb188d7d0cd9e560dae83c.jpgpinned-explorer-taskbar.jpg.1756a35286ce49bf2a7bf9c46f09f3b9.jpgstart-menu.thumb.jpg.de23bac47b0ad841fcc09546ea3a37ce.jpgdevice-manager2.jpg

KEYWORDS: RIGHT CLICK EXPLORER SHORTCUT PINNED TO TASKBAR PINNED TO QUICK ACCESS PIN TO QUICK ACCESS PIN TO EXPLORER PINNED TO EXPLORER OPEN THE WINDOWS DEVICE MANAGER MAXIMIZED BY RUNNING THE OPEN COMMAND IN A WINDOW WITH ADMIN PRIVILEGES.

 

 

 

Coordinates.au3

Edited by somebadhat
IMPROVED CODE

SciTE-Lite V3.5.4   AutoIt 3.3.14.5    AutoItX64=1   os=Windows 10 Pro 64-bit v17134.286   lang=0409/English
"C:\Program Files (x86)\AutoIt3"
i3 @ 3.4GHz, 8GB, Radeon R7 200 Series 2GB, 1TB.

Link to comment
Share on other sites

  • Moderators

somebadhat,

Welcome to the AutoIt forums.

Please try and type without using Caps Lock in future - we do not like being shouted at very much!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Well, im having an issue where the window doesn't even maximize, so your code doesnt work here at all, the screenshot is just a white rectangle. Maybe you could get this information with WMI?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Device Manager doesn't even open on my pc (Win 10) when I run this script.

I suspect that you may also have issues due to security, if you try running the script with #requireadmin at the top does it work? If so then security is your issue.

 

As careca mentioned, perhaps using WMI to capture the information is a better method.

 

Here is something I started but didn't finish that might get you in the right direction:
 

#include <ScrollBarsConstants.au3>
#include <WindowsConstants.au3>
#include <process.au3>
#include <GuiTreeView.au3>
#include <ScreenCapture.au3>
#include <GuiScrollBars.au3>
#include <WinAPISysWin.au3>

#RequireAdmin

$outputFile = @DesktopDir&"\controlPanel.jpg"

;not sure why this is required, I believe you can take a screenshot when the monitor is asleep, just not when the computer is asleep
;and if the computer is asleep I believe you would need more than 1 second to wake it up

Send(" ")

;sleep - if you insist
Sleep ( 1000 )

;open device manager
run("control /name Microsoft.DeviceManager") ;can't interact with this one unless admin

;wait until it is active
WinWaitActive("Device Manager")

;get a handle of things
$WinHndl = WinGetHandle("Device Manager")
$Treeview = ControlGetHandle("Device Manager","","[Class:SysTreeView32]")

;resize
WinMove($WinHndl,"",200,0,800,@DesktopHeight-100)

;expand the treeview control
_GUICtrlTreeView_Expand($Treeview)

MouseMove(300,200)
MouseWheel("up",100)
Sleep(250)

;take the screenshot of everything in device manager
;credit for the screenshot scrolling code goes to monoscout999

;Get Edit1 Vertical Scroll Min/Max range and page size.
$aScrollRange = _GUIScrollBars_GetScrollRange($Treeview, $SB_VERT)
$iPageSize = _GUIScrollBars_GetScrollInfoPage($Treeview, $SB_VERT)
$iPages = Round($aScrollRange[1] / $iPageSize)

;get treeview control size
$aTreeviewPos = ControlGetPos($WinHndl,"",$Treeview)

;Capture
$scrollBarSize = 20
$hDC = _winapi_GetDC($Treeview)
$hCDC = _WinAPI_CreateCompatibleDC($hDC)
$hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $aTreeviewPos[2] - $scrollBarSize , ($aTreeviewPos[3] * ($iPages +1 )))
_WinAPI_SelectObject($hCDC, $hBMP)
For $i = 0 to $iPages+1
    _WinAPI_BitBlt($hCDC, 0, $aTreeviewPos[3] * $i, $aTreeviewPos[2] - $scrollBarSize , ($aTreeviewPos[3] ), $hDC,0, 0, $SRCCOPY)
    _WinAPI_PostMessage($Treeview,$WM_VSCROLL,$SB_PAGEDOWN,0)
    Sleep(250)
Next
_WinAPI_ReleaseDC($Treeview, $hDC)
_WinAPI_DeleteDC($hCDC)
_GDIPlus_Startup()
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
_GDIPlus_ImageSaveToFile($hImage, $outputFile)
_GDIPlus_Shutdown()
_WinAPI_DeleteObject($hBMP)

If FileExists($outputFile) Then ShellExecute($outputFile)

 

Link to comment
Share on other sites

@boomingranny.  Thanks.  Worked right out of the box.  I haven't incorporated it into mine yet.  My code to open and maximize the Device Manager works in my script, on my platform, but I like yours better.

 

  controlPanel.thumb.jpg.75f6497046b9afc553c42a11612f4769.jpg

 

Edited by somebadhat

SciTE-Lite V3.5.4   AutoIt 3.3.14.5    AutoItX64=1   os=Windows 10 Pro 64-bit v17134.286   lang=0409/English
"C:\Program Files (x86)\AutoIt3"
i3 @ 3.4GHz, 8GB, Radeon R7 200 Series 2GB, 1TB.

Link to comment
Share on other sites

@boomingranny,

I incorporated your code into SCRIPT ONE.  SCRIPT TWO needs improvement.
I tried to see if the monitor has to be awake to take a screenshot.  The results so far are inconclusive.

 

Edited by somebadhat

SciTE-Lite V3.5.4   AutoIt 3.3.14.5    AutoItX64=1   os=Windows 10 Pro 64-bit v17134.286   lang=0409/English
"C:\Program Files (x86)\AutoIt3"
i3 @ 3.4GHz, 8GB, Radeon R7 200 Series 2GB, 1TB.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...