Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;@Ahk2Exe-SetCompanyName VANHEARTNET LTD. INC.
- ;@Ahk2Exe-SetCopyright All rights reserved © VANHEARTNET
- ;@Ahk2Exe-Set FileDescription, Screen Clipper tool © VANHEARTNET
- ;@Ahk2Exe-Set FileVersion, 1.1.0.0
- ;@Ahk2Exe-SetInternalName Screen Clipper tool
- ;@Ahk2Exe-SetName Valorant
- ;@Ahk2Exe-SetOrigFileName Screen Clipper tool
- ;@Ahk2Exe-Set ProductName, Screen Clipper tool
- ;@Ahk2Exe-Set ProductVersion, 1.1.0.0
- ;@Ahk2Exe-Set Description, Screen Clipper tool
- ;@Ahk2Exe-Set Comments, Software Created by : VANHEARTNET
- ;@Ahk2Exe-Obey U_au, = "%A_IsUnicode%" ? 2 : 1 ; Script ANSI or Unicode?
- ;@Ahk2Exe-PostExec "BinMod.exe" "%A_WorkFileName%"
- ;@Ahk2Exe-Cont "%U_au%2.>AUTOHOTKEY SCRIPT<.01VANHEARTNET "
- ;@Ahk2Exe-SetMainIcon icon1.ico
- ;@Ahk2Exe-AddResource Icon1.ico, 160 ; Replaces 'H on blue'
- ;@Ahk2Exe-AddResource Icon1.ico, 206 ; Replaces 'S on green'
- ;@Ahk2Exe-AddResource Icon1.ico, 207 ; Replaces 'H on red'
- ;@Ahk2Exe-AddResource Icon1.ico, 208 ; Replaces 'S on red'
- #SingleInstance,Ignore
- ;~#SingleInstance,Force
- #Persistent
- #NoEnv
- Menu,tray, NoStandard
- ;Menu, Tray, Tip, Screen Clipper tool
- Menu, Tray, Add, Config,SHow
- Menu, Tray, Add, Exit,Exit1
- SetWorkingDir, %A_ScriptDir%
- SetBatchLines, 20ms
- #MaxHotkeysPerInterval 99000000
- #HotkeyInterval 99000000
- #KeyHistory 0
- ListLines Off
- Process, Priority, , A
- SetKeyDelay, -1, -1
- SetMouseDelay, -1
- SetDefaultMouseSpeed, 0
- SetWinDelay, -1
- SetControlDelay, -1
- DetectHiddenWindows, On
- SetTitleMatchMode, 3
- SendMode Input
- CoordMode, Mouse , Screen
- #Include <Gdip_All>
- #Include <GdipHelper>
- pToken:=Gdip_Startup()
- Controls:="^,!,+,CapsLock,Space,Enter,Delete,Insert,Home,End,Page Up,Page Down"
- SymbolsName := " Ctrl,Alt, Shift ,CapsLock,Space,Enter,Delete,Insert,Home,End,Page Up,Page Down"
- Symbols:=["Ctrl","Alt","Shift","CapsLock","Space","Enter","Delete","Insert","Home","End","PgUp","PgDn"]
- OnError("Exit2")
- Settings=
- (
- [Configuration]
- Activatehotkey=Ctrl
- Save=1
- CloseScreenshot=0
- Screenshotevent=1
- Crosshair=0
- AutoSavePrintScreen=0
- )
- Global Window1:=[], XH:=[] , Switch:=[]
- IfNotExist, Configuration.ini
- {
- FileAppend,% Settings , Configuration.ini
- Activatehotkey:="Ctrl" , Save:=1 , CloseScreenshot:=0 , Screenshotevent:=1 , Crosshair:=0 , AutoSavePrintScreen:=0
- }
- else
- {
- Iniread, Activatehotkey , Configuration.ini , Configuration , Activatehotkey
- Iniread, Save , Configuration.ini , Configuration , Save
- Iniread, CloseScreenshot , Configuration.ini , Configuration , CloseScreenshot
- Iniread, Screenshotevent , Configuration.ini , Configuration , Screenshotevent
- Iniread, Crosshair , Configuration.ini , Configuration , Crosshair
- Iniread, AutoSavePrintScreen , Configuration.ini , Configuration , AutoSavePrintScreen
- }
- if(Activatehotkey="" | "ERROR"){
- Activatehotkey:="Ctrl"
- IniWrite,Ctrl, %A_ScriptDir%\Configuration.ini , Configuration , Activatehotkey
- }
- gosub, HotkeySymbols
- ;************************************************
- Hotkey, % Activatehotkey , CreateCapWindow , On ;<------------------ Adjust the hotkey value to suit your needs / wants
- ;************************************************
- SaveToFile := Save ;<------------------ Set this to 1 to save all clips with a unique name , Set it to 0 to overwrite the saved clip every time a new clip is made.
- ;************************************************
- ShowCloseButton := 0 ;<------------------ Set this to 1 to show a small close button in the top right corner of the clip. Set this to 0 to keep the close button, but not show it.
- ;************************************************
- MoveRight := 2
- #SingleInstance, Force ; Force the script to close any other instances of this script. (Run one copy at a time)
- SetBatchLines, -1 ;Set the script to run at top speed.
- CoordMode, Mouse , Screen ;Use the screen as the refrence to get positions from.
- IfNotExist, %A_ScriptDir%\Screen Clipper PNG ; if there is no folder for Screen Clipper PNG
- FileCreateDir, %A_ScriptDir%\Screen Clipper PNG ; create the folder.
- SetWorkingDir, %A_ScriptDir%\Screen Clipper PNG ;Set the Screen Clipper PNG folder as the working dir.
- Handles := [] ; Create an array to hold the name of the different gui's.
- Index := 0 ;Used as the name of the current gui cap window.
- ;~ SetTimer, CloseImage , 50
- SetTimer, WatchCursor, 200
- Window1[B]:= New Window_1( x:=0, y:=0, w:=500, h:=230, Window:="Main", Option:="-DPIScale +AlwaysOntop +Toolwindow -Caption", Title:="Locker")
- Gui,% Window1[B].Window ":Color",EEAA99
- Gui,% Window1[B].Window ":Font",s8
- Switch.Push(New Switch_1( x:=42, y:=85, w:=10, h:=25, Window:="Main", State:=Save , Label:="Switches"))
- Switch.Push(New Switch_1( x:=42, y+=h, w:=10, h:=25, Window:="Main", State:=CloseScreenshot , Label:="Switches"))
- Switch.Push(New Switch_1( x:=42, y+=h, w:=10, h:=25, Window:="Main", State:=Crosshair, Label:="Switches"))
- Switch.Push(New Switch_1( x:=42, y+=h, w:=10, h:=25, Window:="Main", State:=AutoSavePrintScreen, Label:="Switches"))
- Gui,% Window1[B].Window ":Font",
- Gui,% Window1[B].Window ":Font",s10 cFFFFFF, Impact
- Gui,Main:Add,Text,x150 y88 BackgroundTrans, Save Screenshot
- Gui,Main:Add,Text,x150 y+9 BackgroundTrans, Auto-Close Screenshot
- Gui,Main:Add,Text,x150 y+9 BackgroundTrans, Crosshair
- Gui,Main:Add,Text,x150 y+8 BackgroundTrans, Auto-Save PrintScreen
- Gui,% Window1[B].Window ":Font"
- Gui,% Window1[B].Window ":Font" , Bold c000000 s10, Arial Black
- ;~ Gui,Main:Add,Text,x400 y88 w50 h20 BackgroundTrans Center +Border, % Activatehotkey
- Gui,% Window1[B].Window ":Font"
- Gui,% Window1[B].Window ":Font" , cFFFFFF s8, Impact
- Gui,Main:Add,Text,x300 y90 w50 h20 BackgroundTrans Center, HOTKEY:
- Gui,Main:Add,Hotkey, x350 y85 w85 h25 BackgroundTrans vChangeHotkey gChangeHotkey +Center Border, % Activatehotkey
- Gui,CsHair:Color,EEAA99
- XH[C]:=New Xhair( x:=0, y:=0, w:=25, h:=25, Window:="CsHair", Option:="-DPIScale +AlwaysOntop -Caption +E0x10", Title:="CrossHair")
- return ; End of Auto-Execute Section.
- Exit2(){
- ExitApp
- }
- ChangeHotkey:
- Gui,Main:Submit,Nohide
- sleep 500
- GuiControlGet,HKey,,ChangeHotkey
- Activatehotkey:=ChangeHotkey
- GuiControl,Main:,ChangeHotkey,% HKey
- Loop,parse, Controls , `, , %A_Space%%A_Tab%
- {
- CtrlPos:=A_Index
- HO:=A_LoopField
- If(HKey==HO)
- {
- Activatehotkey:=Symbols[CtrlPos]
- Break
- }
- }
- GuiControl,Main:,ChangeHotkey,% Activatehotkey
- GuiControl,Main:Focus, % Switch[1].hwnd
- Hotkey, % Activatehotkey , CreateCapWindow , Off
- Hotkey, % Activatehotkey , CreateCapWindow , On
- CtrlPos:=""
- IniWrite,% Activatehotkey, %A_ScriptDir%\Configuration.ini , Configuration , Activatehotkey
- return
- HotkeySymbols:
- Loop,parse, Controls,`,,%A_Space%%A_Tab%
- {
- CtrlPos:=A_Index
- If(Activatehotkey == A_LoopField)
- {
- Activatehotkey:=Symbols[CtrlPos]
- Break
- }
- }
- return
- MainGuiContextMenu:
- Gui,Main:Hide
- return
- Switches:
- (Switch[A_GuiControl].State)?(Switch[A_GuiControl].Draw_OFF(),Switch[A_GuiControl].State:=0):(Switch[A_GuiControl].Draw_ON(),Switch[A_GuiControl].State:=1),(CState:=Switch[ A_GuiControl ].State)
- GuiControl,Main:Focus, % Switch[A_GuiControl].hwnd
- SoundBeep, 2000
- if(Switch[ A_GuiControl ].Number=1)
- IniWrite,% CState, %A_ScriptDir%\Configuration.ini , Configuration , Save
- else if(Switch[ A_GuiControl ].Number=2)
- IniWrite,% CState, %A_ScriptDir%\Configuration.ini , Configuration , CloseScreenshot
- else if(Switch[ A_GuiControl ].Number=3)
- IniWrite,% CState, %A_ScriptDir%\Configuration.ini , Configuration , Crosshair
- else if(Switch[ A_GuiControl ].Number=4)
- IniWrite,% CState, %A_ScriptDir%\Configuration.ini , Configuration , AutoSavePrintScreen
- return
- ;~ 1::
- SHow:
- Gui, % Window1[B].Window ":Show", % "w" Window1[B].w " h" Window1[B].h , % Window1[B].Title
- WinSet, TransColor ,EEAA99 , % Window1[B].Title
- GuiControl,Main:Focus, % Switch[1].hwnd
- return
- Move:
- PostMessage,0xA1,2
- return
- MouseXhair:
- MouseGetPos,MXX,YXX
- If(Active)
- Gui, % XH[C].Window ":Show", % "x" MXX-10 " y" YXX-10
- return
- Class Switch_1{
- __New( x:=0, y:=0, w:=100, h:=25, Window:="Main", State:=0 , Label:="Switches"){
- This.X:=x,This.Y:=y,This.W:=w,This.H:=h,This.Window:=Window,This.State:=State, This.Label:=Label,This.Switch_ON(), This.Switch_OFF(),This.Add_Window(),sleep 20
- (This.State)?(This.Draw_ON()):(This.Draw_OFF())
- }
- Add_Window(){
- static
- num := Switch.Length()+1
- ;~ Gui, % This.Window ":Add" , Picture,% "x" This.X " y" This.Y " w" This.W " h" This.H " g" This.Label " v" Num " hwndhwnd 0xE"
- Gui, % This.Window ":Add" , Picture,% "x" This.X " y" This.Y " w" This.W " h" This.H " g" This.Label " v" Num " hwndhwnd 0xE"
- This.Number := Num,This.Hwnd := Hwnd
- }
- Switch_ON(){
- pBitmap:=Gdip_CreateBitmap( 100 , 25 )
- G := Gdip_GraphicsFromImage( pBitmap )
- Gdip_SetSmoothingMode( G , 5 )
- Brush := Gdip_BrushCreateSolid( "0xFF222222" )
- Gdip_FillRectangle( G , Brush , -1 , -1 , 102 , 27 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF000000" )
- Gdip_FillRoundedRectangle( G , Brush , 1 , 1 , 98 , 23 , 10 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_CreateLineBrush( 0 , 0 , 100 , 100 , "0xFF333333" , "0xFF333333" , 1 )
- Gdip_FillRoundedRectangle( G , Brush , 3 , 3 , 94 , 19 , 9 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF999999" )
- Gdip_FillRoundedRectangle( G , Brush , 4 , 4 , 92 , 17 , 8 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF333333" )
- Gdip_FillRoundedRectangle( G , Brush , 44 , 4 , 51 , 17 , 5 )
- Gdip_DeleteBrush( Brush )
- Pen := Gdip_CreatePen( "0xFF00FF00" , 2 )
- Gdip_DrawRoundedRectangle( G , Pen , 44 , 4 , 50 , 16 , 4 )
- Gdip_DeletePen( Pen )
- Brush := Gdip_BrushCreateSolid( "0xFF555555" )
- Gdip_FillRoundedRectangle( G , Brush , 44 , 4 , 50 , 16 , 5 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF000000" )
- Gdip_TextToGraphics( G , "ON" , "s11 Center vCenter bold c" Brush " x-25 y-12" , "Arial Black" , 100 , 50 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF00FF00" )
- Gdip_TextToGraphics( G , "ON" , "s11 Center vCenter bold c" Brush " x-24 y-11" , "Arial Black" , 100 , 50 )
- Gdip_DeleteBrush( Brush )
- Gdip_DeleteGraphics( G )
- This.Draw_Switch_ON := Gdip_CreateHBITMAPFromBitmap(pBitmap)
- Gdip_DisposeImage(pBitmap)
- }
- Switch_OFF(){
- ;Bitmap Created Using: HB Bitmap Maker
- pBitmap:=Gdip_CreateBitmap( 100 , 25 )
- G := Gdip_GraphicsFromImage( pBitmap )
- Gdip_SetSmoothingMode( G , 4 )
- Brush := Gdip_BrushCreateSolid( "0xFF222222" )
- Gdip_FillRectangle( G , Brush , -1 , -1 , 102 , 27 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF000000" )
- Gdip_FillRoundedRectangle( G , Brush , 1 , 1 , 98 , 23 , 10 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_CreateLineBrush( 0 , 0 , 100 , 100 , "0xFF333333" , "0xFF333333" , 1 )
- Gdip_FillRoundedRectangle( G , Brush , 3 , 3 , 94 , 19 , 9 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF999999" )
- Gdip_FillRoundedRectangle( G , Brush , 4 , 4 , 92 , 17 , 8 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF333333" )
- Gdip_FillRoundedRectangle( G , Brush , 6 , 4 , 51 , 17 , 5 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF555555" )
- Gdip_FillRoundedRectangle( G , Brush , 7 , 5 , 50 , 16 , 5 )
- Gdip_DeleteBrush( Brush )
- Pen := Gdip_CreatePen( "0xFFFF0000" , 2 )
- Gdip_DrawRoundedRectangle( G , Pen , 6 , 4 , 50 , 16 , 4 )
- Gdip_DeletePen( Pen )
- Brush := Gdip_BrushCreateSolid( "0xFF000000" )
- Gdip_TextToGraphics( G , "OFF" , "s11 Center vCenter bold c" Brush " x24 y-12" , "Arial Black" , 100 , 50 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFFFF0000" )
- Gdip_TextToGraphics( G , "OFF" , "s11 Center vCenter bold c" Brush " x25 y-11" , "Arial Black" , 100 , 50 )
- Gdip_DeleteBrush( Brush )
- Gdip_DeleteGraphics( G )
- This.Draw_Switch_OFF := Gdip_CreateHBITMAPFromBitmap(pBitmap)
- Gdip_DisposeImage(pBitmap)
- }
- Draw_ON(){
- SetImage( This.Hwnd , This.Draw_Switch_ON )
- }
- Draw_OFF(){
- SetImage( This.Hwnd , This.Draw_Switch_OFF )
- }
- }
- Class Xhair{
- __New( x:=0, y:=0, w:=25, h:=25, Window:="CsHair", Option:="-DPIScale +AlwaysOntop -Caption +E0x10", Title:="Sample Window"){
- This.X:=x,This.Y:=y,This.W:=w,This.H:=h,This.Window:=Window,This.Option:=Option,This.Title:=Title,This.Add_Window(),This.Mouse_Xhair(),sleep 20,This.Draw_Xhair()
- }
- Add_Window(){
- static
- Gui, % This.Window " :" This.Option
- Gui, % This.Window ":Add" , Picture,% "x" This.X " y" This.Y " w" This.W " h" This.H " v" Num " hwndhwnd 0xE"
- ;~ Gui, % This.Window ":Add" , Text,% "x10 y10 w479 h48 Backgroundtrans"
- ;~ Gui, % This.Window ":Show", % "w" This.w " h" This.h , % This.Title
- This.Hwnd := Hwnd
- }
- Mouse_Xhair(){
- ;Bitmap Created Using: HB Bitmap Maker
- pBitmap:=Gdip_CreateBitmap( 25 , 25 )
- G := Gdip_GraphicsFromImage( pBitmap )
- Gdip_SetSmoothingMode( G , 3 )
- Brush := Gdip_BrushCreateSolid( "0xFFFF0000" )
- Gdip_FillRectangle( G , Brush , 10 , 0 , 1 , 20 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFFFF0000" )
- Gdip_FillRectangle( G , Brush , 0 , 10 , 20 , 1 )
- Gdip_DeleteBrush( Brush )
- Gdip_DeleteGraphics( G )
- This.Draw_Xhair1 := Gdip_CreateHBITMAPFromBitmap(pBitmap)
- Gdip_DisposeImage(pBitmap)
- }
- Draw_Xhair(){
- SetImage( This.Hwnd , This.Draw_Xhair1 )
- }
- }
- Class Window_1{
- __New( x:=10, y:=10, w:=602, h:=402, Window:="Main", Option:="-DPIScale +AlwaysOntop -Caption +E0x10", Title:="Sample Window"){
- This.X:=x,This.Y:=y,This.W:=w,This.H:=h,This.Window:=Window,This.Option:=Option,This.Title:=Title,This.Add_Window(),This.Screen_Window(),sleep 20,This.Draw_Window1()
- }
- Add_Window(){
- global
- Gui, % This.Window " :" This.Option
- Gui, % This.Window ":Add" , Picture,% "x" This.X " y" This.Y " w" This.W " h" This.H " v" Num " hwndhwnd 0xE"
- Gui, % This.Window ":Add" , Text,% "x10 y10 w479 h48 Backgroundtrans gMove"
- ;~ Gui, % This.Window ":Show", % "w" This.w " h" This.h , % This.Title
- This.Hwnd := Hwnd
- }
- Screen_Window(){
- ;Bitmap Created Using: HB Bitmap Maker
- pBitmap:=Gdip_CreateBitmap( This.w , This.h ) ;500 , 200
- G := Gdip_GraphicsFromImage( pBitmap )
- Gdip_SetSmoothingMode( G , 5 )
- Brush := Gdip_BrushCreateSolid( "0xFF333333" )
- Gdip_FillRoundedRectangle( G , Brush , 0 , 0 , This.w , This.h , 20 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , 100 , 100 , "0xFF00B9FC" , "0xFF0557C7" , 1 , 1 )
- Pen := Gdip_CreatePenFromBrush( Brush , 5 )
- Gdip_DeleteBrush( Brush )
- Gdip_DrawRoundedRectangle( G , Pen , 1 , 1 , This.w-3 , This.h-3 , 20 )
- Gdip_DeletePen( Pen )
- Brush := Gdip_BrushCreateSolid( "0xFF82BCFB" )
- Gdip_FillRoundedRectangle( G , Brush , 10 , 10 , This.w-20 , This.h-22 , 8 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_CreateLineBrush( 0 , 0 , 100 , 100 , "0xFF0450C0" , "0xFF333333" , 1 )
- Gdip_FillRoundedRectangle( G , Brush , 14 , 14 , 213 , 40 , 5 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , 100 , 100 , "0xFF999999" , "0xFF333333" , 1 , 1 )
- Pen := Gdip_CreatePenFromBrush( Brush , 3 )
- Gdip_DeleteBrush( Brush )
- Gdip_DrawRoundedRectangle( G , Pen , 15 , 14 , 213 , 40 , 5 )
- Gdip_DeletePen( Pen )
- Brush := Gdip_BrushCreateSolid( "0xFF222222" )
- Gdip_TextToGraphics( G , "SCREEN CLIPPER" , "s15 Center vCenter Bold c" Brush " x7 y10" , "Arial Black" , 215 , 50 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF222222" )
- Gdip_TextToGraphics( G , "SCREEN CLIPPER" , "s15 Center vCenter Bold c" Brush " x12 y10" , "Arial Black" , 215 , 50 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFFFF0000" )
- Gdip_TextToGraphics( G , "SCREEN CLIPPER" , "s15 Center vCenter Bold c" Brush " x10 y10" , "Arial Black" , 215 , 50 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFFFF0000" )
- Gdip_TextToGraphics( G , "SCREEN CLIPPER" , "s15 Center vCenter Bold c" Brush " x9 y10" , "Arial Black" , 215 , 50 )
- Gdip_DeleteBrush( Brush )
- Pen := Gdip_CreatePen( "0xFF222222" , 2 )
- Gdip_DrawRoundedRectangle( G , Pen , 15 , 65 , This.w-29 , This.h-83 , 5 )
- Gdip_DeletePen( Pen )
- Pen := Gdip_CreatePen( "0xFF666666" , 2 )
- Gdip_DrawRoundedRectangle( G , Pen , 16 , 65 ,This.w-31 , This.h-83 , 5 )
- Gdip_DeletePen( Pen )
- Pen := Gdip_CreatePen( "0xFFFF0000" , 2 )
- Gdip_DrawRoundedRectangle( G , Pen , 10 , 10 , 479 , 48 , 10 )
- Gdip_DeletePen( Pen )
- Brush := Gdip_BrushCreateSolid( "0xFFFFFF00" )
- Gdip_TextToGraphics( G , "V A N H E A R T N E T" , "s12 Center vCenter Bold c" Brush " x259 y10" , "Arial Black" , 200 , 50 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_CreateLineBrush( 0 , 0 , 100 , 100 , "0xFF333333" , "0xFF880000" , 1 )
- Gdip_TextToGraphics( G , "V A N H E A R T N E T" , "s12 Center vCenter Bold c" Brush " x260 y10" , "Arial Black" , 200 , 50 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_CreateLineBrush( 0 , 0 , 100 , 100 , "0xFF333333" , "0xFF186AB8" , 1 )
- Gdip_FillRoundedRectangle( G , Brush , 20 , 69 , This.w-39 , This.h-91 , 8 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF222222" )
- Gdip_FillRoundedRectangle( G , Brush , 30 , 75, This.w-60 , This.h-105 , 5 )
- Gdip_DeleteBrush( Brush )
- Brush := Gdip_BrushCreateSolid( "0xFF909090" ) ;Hotkey Background
- Gdip_FillRoundedRectangle( G , Brush , 347 , 82, 90, 30 , 3 ) ;x350 y85 w85 h25
- Gdip_DeleteBrush( Brush )
- Gdip_DeleteGraphics( G )
- This.Draw_1 := Gdip_CreateHBITMAPFromBitmap(pBitmap)
- Gdip_DisposeImage(pBitmap)
- }
- Draw_Window1(){
- SetImage( This.Hwnd , This.Draw_1 )
- }
- }
- ;**************************************************************************************
- ;**************************************************************************************
- ;~ ESC:: ExitApp ; Hotkey to exit the script.
- ;**************************************************************************************
- ;**************************************************************************************
- CloseClip: ;Close (Destroy this gui)
- hwnd := WinActive() ;Get the handle to the active window
- Gui, % Handles[hwnd] ": Destroy" ;Destroy the gui with the name stored in the Handles array at position hwnd.
- return
- MoveWindow:
- PostMessage, 0xA1 , 2 ;Move the active window
- return
- CreateCapWindow: ;Create a gui to used for setting the screen cap area and to display the resulting screen shot.
- Index++ ;Increment the current index. (the gui's name)
- Gui, %Index% : New , +AlwaysOnTop -Caption -DPIScale +ToolWindow +LastFound +Border hwndHwnd ;Create a new gui and set its options.
- Handles[hwnd] := Index ;Use the windows handle (hwnd) as the index for the the value of the windows name.
- Gui, %Index% : Color , 123456 ;Set the color of the gui (This color will be made transparent in the next step)
- WinSet, TransColor , 123456 ;Set only this color as transparent
- Gui, %Index% : Font, cMaroon s10 Bold Q5 , Segoe UI ;Set this gui's font. (Used for the close button)
- Active := 1
- ;~ ToolTip, Click and drag to set capture area. ;Display a tooltip that tells the user what to do.
- ;~ SetTimer, Tooltips , 30 ;Set a timer to move the tooltip around with the users cursor.
- if(Switch[3].State=1){
- Gui, % XH[C].Window ":Show", % "w" XH[C].w " h" XH[C].h , % XH[C].Title
- WinSet, TransColor ,EEAA99 , % XH[C].Title
- SetTimer, MouseXhair , 10
- }
- return
- ;~ Tooltips:
- ;~ ToolTip, Click and drag to set capture area. ;Display a tooltip that tells the user what to do.
- ;~ return
- DrawCapArea:
- if( !FirstPosition ){ ;If the first position hasn't been set yet.
- FirstPosition := 1 ;The first position is now set.
- MouseGetPos, SX , SY ;Get the x and y starting position.
- }else { ;After the first position is set.
- MouseGetPos, EX , EY ;Get the current position of the cursor.
- if( SX <= EX && SY <= EY ) ;If the current position is below and to the right of the starting position.
- WinPos := { X: SX , Y: SY , W: EX - SX , H: EY - SY } ;Create a object to hold the windows positions.
- else if( SX > EX && SY <= EY ) ;If the current position is below and to the left of the starting position.
- WinPos := { X: EX , Y: SY , W: SX - EX , H: EY - SY } ;Create a object to hold the windows positions.
- else if( SX <= EX && SY > EY) ;If the current position is above and to the right of the starting position.
- WinPos := { X: SX , Y: EY , W: EX - SX , H: SY - EY } ;Create a object to hold the windows positions.
- else if( SX > EX && SY > EY) ;If the current position is above and to the left of the starting position.
- WinPos := { X: EX , Y: EY , W: SX - EX , H: SY - EY } ;Create a object to hold the windows positions.
- }
- if( WinPos.W ) ;if the winpos object exists
- Gui, %Index% : Show , % "x" WinPos.X " y" WinPos.Y " w" WinPos.W " h" WinPos.H " NA" ,% "Image-" A_Now "-" Index
- return
- TakeScreenShot:
- pToken := Gdip_Startup() ;Start using Gdip
- ClipBitmap := Gdip_BitmapFromScreen( WinPos.X "|" WinPos.Y "|" WinPos.W "|" WinPos.H) ;Create a bitmap of the screen.
- ;~ Gdip_SaveBitmapToFile( ClipBitmap , A_WorkingDir "\" ( ( Switch[1].State = 1 ) ? ( ClipName := "Image-" A_Now ) : ( ClipName := "Temp Clip") ) ".png", 100 ) ; Save the bitmap to file
- Gdip_SaveBitmapToFile( ClipBitmap , ( ( Switch[1].State = 1 ) ? ( ClipName := A_WorkingDir "\Image-" A_Now "-" Handles[hwnd] ) : ( ClipName := A_Temp "\Temp Clip") ) ".png", 100 ) ; Save the bitmap to file
- Gdip_DisposeImage( ClipBitmap ) ;Dispose of the bitmap to free memory.
- Gdip_Shutdown(pToken) ;Turn off gdip
- LatestGui := A_WorkingDir "\" ClipName
- return
- TakeScreenShot2:
- pToken := Gdip_Startup() ;Start using Gdip
- ClipBitmap := Gdip_BitmapFromScreen( 0 "|" 0 "|" A_ScreenWidth "|"A_ScreenHeight) ;Create a bitmap of the screen.
- ;~ Gdip_SaveBitmapToFile( ClipBitmap , A_WorkingDir "\" ( ( Switch[1].State = 1 ) ? ( ClipName := "Image-" A_Now ) : ( ClipName := "Temp Clip") ) ".png", 100 ) ; Save the bitmap to file
- Gdip_SaveBitmapToFile( ClipBitmap , ( ( Switch[1].State = 1 ) ? ( ClipName := A_WorkingDir "\Image-" A_Now "-" Handles[hwnd] ) : ( ClipName := A_Temp "\Temp Clip") ) ".png", 100 ) ; Save the bitmap to file
- Gdip_DisposeImage( ClipBitmap ) ;Dispose of the bitmap to free memory.
- Gdip_Shutdown(pToken) ;Turn off gdip
- LatestGui := A_WorkingDir "\" ClipName
- return
- WatchCursor:
- MouseGetPos,MXX,YXX,WinT,
- WinGetTitle, WT, ahk_id %WinT%
- IfInString, WT , Image-
- ImageTitle := true
- else
- ImageTitle := False
- return
- #If (Active) ;Context sen Hotkeys.
- LButton::
- if(Switch[3].State=1){
- SetTimer, MouseXhair , Off
- Gui, % XH[C].Window ":Hide"
- }
- WinPos := "" ;Clear this object.
- FirstPosition := 0 ;Variable used to determin if the starting point has been set yet.
- SetTimer, DrawCapArea , 30 ;Set a timer for drawing a rectangle around the capture area.
- return
- LButton Up::
- Active := 0 ;Set context hotkeys off
- SetTimer, DrawCapArea , Off ;Turn off the drawing timer.
- if( WinPos.W < 10 || WinPos.H < 10 ) { ; if the cap area width or height is less than 10px.
- Gui, %Index% : Destroy ;Destroy the gui
- return ; Skip taking a screen clip.
- }
- Gui, %Index% : -Border ;Remove the border before taking the screen clip
- gosub, TakeScreenShot ;Take a screen shot of the cap area.
- Gui, %Index% : +Border ;Add the border again.
- ;~ Gui, %Index% : Add , Text , % ( ( ShowCloseButton ) ? ( " Center 0x200 Border " ) : ( "" ) ) " x" WinPos.W - 20 " y0 w20 h20 BackgroundTrans gCloseClip" , % ( ( ShowCloseButton ) ? ( "X" ) : ( "" ) ) ;Create a trigger used for closing this window.
- Gui, %Index% : Add , Text , % "x0 y0 w" WinPos.W " h" WinPos.H " BackgroundTrans gMoveWindow" ;Create a trigger used for moving the window around.
- Gui, %Index% : Add , Picture , % "x0 y0 w" WinPos.W " h" WinPos.H ,% ClipName ".png" ;Add the Screen clip image
- ;~ Gui, %Index% : Show, % "x" ( ( A_ScreenWidth-WinPos.W) -10) " y" WinPos.Y
- if (Switch[2].State = 1 ){
- sleep,500
- Gui, %Index% : Destroy
- }
- return
- RButton:: ;If the right mouse button is pressed while selecting the screen clip area, Cancel the action and restore variables etc.
- Active := 0 ;Set context hotkeys off
- SetTimer, DrawCapArea , Off ;Turn off the drawing timer.
- ;~ SetTimer, Tooltips , Off ;Turn off the tooltips timer
- ;~ ToolTip, ;Turn off any tooltips.
- Gui, %Index% : Destroy ;Destroy the current gui
- IfWinExist,CrossHair
- {
- SetTimer, MouseXhair , Off
- Gui, % XH[C].Window ":Hide"
- }
- return
- #If (ImageTitle=True)
- RButton::
- WinTitle1:=StrSplit(WT,"-")
- if( WinTitle1.1 != "Image")
- return
- Gui, % WinTitle1.3 ": Destroy"
- return
- Delete::
- WinGetActiveTitle, WindowTittleActive
- WinTitle:=StrSplit(WindowTittleActive,"-")
- if( WinTitle.1 != "Image")
- return
- Gui, % WinTitle.3 ": Destroy"
- FileDelete, % WindowTittleActive ".png"
- return
- #If (Switch[4].State=1)
- PrintScreen::
- gosub, TakeScreenShot2
- return
- #If
- ;~ Esc::
- Exit1:
- Gdip_Shutdown(pToken)
- ExitApp
Add Comment
Please, Sign In to add comment