Tirar print e salvar coordenada

Tire suas dúvidas sobre programação em AutoHotkey

Moderator: Gio

TheAngels

Tirar print e salvar coordenada

Post by TheAngels » 18 Jan 2021, 11:11

Boa tarde, estou com um problema em um script que estou tentando fazer....

Preciso que o auto hotkey tire print da tela, e salve a coordenada desejada, para mais para frente comparar a imagem e selecionar a opção correta.

Já fiz o script todo, falta somente a parte de tirar print da tela e salvar somente parte da print (como se fosse um recorte de imagem automatico)
Alguem tem alguma idéia do que posso usar???
theangels

Re: Tirar print e salvar coordenada

Post by theangels » 18 Jan 2021, 11:26

queria algo como se fosse isso

printscreen, 563, 347 , 830, 479 , C:\Users\gg\Desktop\teste.png
garry
Posts: 3743
Joined: 22 Dec 2013, 12:50

Re: Tirar print e salvar coordenada

Post by garry » 18 Jan 2021, 16:36

exemplo com 'irfanview'

Code: Select all

;-https://www.irfanview.com/
#warn
#NoEnv
#Singleinstance,force
setworkingdir,%a_scriptdir%
;Coordmode,mouse,window
;--------------------------------------

!0::   ; press ALT+0 = whole desktop                              
!3::   ; press ALT+3 = active window
;---------------------------------------
Modus:= SubStr(A_ThisHotkey,2,1)
Destination=%a_desktop%\TEST_IRFAN
IfNotExist, %Destination%
  FileCreateDir, %Destination%
F1=%destination%\%A_now%_teste.png
x:=563, y:=347 , w:=830, h:=479
PR=%A_ProgramFiles%\IrfanView\i_view64.exe
AA=/capture=%modus% /crop=(%x%,%y%,%w%,%h%) /convert=%F1%
runwait,%PR% %AA%
run,%F1%
return
esc::exitapp
;=============================================
exemplo-2

Code: Select all

;- modified = 20210119
;- created  = 20210118
;- https://www.irfanview.com/
;- this script save screen as picture jpg/png... ( crop )
#warn
#NoEnv
#Singleinstance,force
setworkingdir,%a_scriptdir%
;Coordmode,pixel,client
Coordmode,mouse,window
;----------------------------------------------------------
;- check if active window is really active if use modus 3
;--------------------------------------
!0::   ; press ALT+0 = whole  window                              
!3::   ; press ALT+3 = active window
;-*~$printscreen::    ;- example when define modus 0 or 3 
;---------------------------------------
Modus:= SubStr(A_ThisHotkey,2,1)
;--- calculate x y w h as procent ----------
wa:=A_screenwidth,ha:=A_screenHeight,xx:=100
if (modus=0)  ;- whole screen
   x:=(wa*40)//xx,y:=(ha*0)//xx,w:=(wa-x),h:=(ha*50)//xx 
if (modus=3)  ;- Active Window
   {
   WinGetPos,x1,y1,w1,h1,A
   x:=((w1*40)//xx),y:=((h1*0)//xx),w:=w1-x,h:=(h1*50)//xx
   ;msgbox,X1=%x1%  y1=%y1%   w1=%w1%  H1=%h1%`nX=%x%  y=%y%   w=%w%  H=%h%
   ;return
   }
Destination=%a_desktop%\TEST_IRFAN
IfNotExist, %Destination%
  FileCreateDir, %Destination%
F1=%destination%\%A_now%_teste.jpg
PR=%A_ProgramFiles%\IrfanView\i_view64.exe
AA=/capture=%modus% /crop=(%x%,%y%,%w%,%h%) /convert=%F1%
runwait,%PR% %AA%
run,%F1%
return
esc::exitapp
;=============================================
Post Reply

Return to “Ajuda e Suporte Geral”