Sign in to follow this  
Followers 0
Ruben

Just some scripts

2 posts in this topic

#1 ·  Posted (edited)

Well i was bored so i decided to make some scripts for fun.

Screen dpi checker, use this to know the real dpi of your screen

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 293, 112, 192, 114)
$Input1 = GUICtrlCreateInput("16", 20, 20, 31, 21)
$Input2 = GUICtrlCreateInput("9", 60, 20, 31, 21)
$Input3 = GUICtrlCreateInput("24", 100, 20, 21, 21)
$Input4 = GUICtrlCreateInput("1920", 20, 50, 111, 21)
$Input5 = GUICtrlCreateInput("1080", 20, 80, 111, 21)
$Label1 = GUICtrlCreateLabel("Label1", 150, 30, 123, 60)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel(":", 54, 22, 5, 17)
$Label3 = GUICtrlCreateLabel("''", 125, 20, 8, 17)
$Label4 = GUICtrlCreateLabel("x", 10, 66, 9, 17)
GUICtrlSetColor(-1, 0x000000)
GUISetState(@SW_SHOW)



While 1
$ratio_w = GUICtrlRead($Input1)
$ratio_h = GUICtrlRead($Input2)
$d = Sqrt($ratio_w^2 + $ratio_h^2)
$size = GUICtrlRead($Input3)
$porp = $size / $d
$w = $ratio_w*$porp
$h = $ratio_h*$porp
$res_w = GUICtrlRead($Input4)
$res_h = GUICtrlRead($Input5)
$dpi = Round($res_w/$w,1)
GUICtrlSetData ( $Label1, $dpi & " dpi" )


$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch

Sleep(1)
WEnd

Desktop replicator, it shows the whole desktop in a small window in realtime, it may be useful to someone for some project maybe?

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>


$Form2 = GUICreate("Form2", 503, 294, 235, 329)
$Pic1 = GUICtrlCreatePic(@ScriptDir & "temp.bmp",10, 10, 480, 270)
GUISetBkColor(0x000000)
GUISetState(@SW_SHOW)


While 1
_ScreenCapture_Capture(@ScriptDir & "temp.bmp",0, 0, @DesktopWidth, @DeskTopHeight,False)
Sleep(16)
GUICtrlSetImage ( $Pic1, @ScriptDir & "temp.bmp")
WEnd

This is another print screen to file, im sure there are other scripts that do this already... well here's it anyway... use printscreen button to save a screenshot of the active window and win+printscreen for the whole desktop, it will save them in the same dir of the script.

#include <ScreenCapture.au3>
#include <Date.au3>



HotKeySet('{PRINTSCREEN}','winscreen')
HotKeySet('#{PRINTSCREEN}','deskscreen')

Sleeping()

Func winscreen()
Local $i = 01
Local $size = WinGetPos("[ACTIVE]")
Local $namewin = WinGetTitle("[active]")
If @error = 1 Then
MsgBox(0, "", "Error")
EndIf
$search = FileFindFirstFile(@ScriptDir & "" & $namewin & "_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg")
While 1
If $search = -1 Then
_ScreenCapture_Capture(@ScriptDir & "" & $namewin & "_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg", $size[0], $size[1], $size[0]+$size[2], $size[1]+$size[3],False)
ExitLoop
Else
$i = $i+1
$search = FileFindFirstFile(@ScriptDir & "" & $namewin & "_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg")
EndIf
WEnd
Sleeping()
EndFunc

Func deskscreen()
Local $i = 01

$search = FileFindFirstFile(@ScriptDir & "desktop_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg")
While 1
If $search = -1 Then
_ScreenCapture_Capture(@ScriptDir & "desktop_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg", 0,0, @DeskTopWidth, @DeskTopHeight,False)
ExitLoop
Else
$i = $i+1
$search = FileFindFirstFile(@ScriptDir & "desktop_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg")
EndIf
WEnd
Sleeping()
EndFunc

Func Sleeping()
While 1
Sleep(500)
WEnd
EndFunc
Edited by Ruben
1 person likes this

Share this post


Link to post
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
Sign in to follow this  
Followers 0