Page 2 of 2

Re: Screen Clipper by LearningOne. Can we make standalone?

Posted: 09 Nov 2020, 13:07
by iilabs
I have the code you shared with me a week ago. Sorry I am not sure how to to approach this. Would I use the GUI one for this? Can I paste the clipboard or %out% to GUI and resize as you suggest?

Code: Select all

F3::                                                 ;Hold F3 to make a selection, then release
{
MouseGetPos, x1, y1
SoundBeep, 1500, 20
KeyWait, %A_ThisHotkey%
SoundBeep, 1000, 20
MouseGetPos, x2, y2
width := x2 - x1, height := y2 - y1
If (width < 4 && height < 4)
 Return
pToken := Gdip_Startup(), snap := Gdip_BitmapFromScreen(x1 "|" y1 "|" width "|" height)
Gdip_SetBitmapToClipboard(snap), Gdip_SaveBitmapToFile(snap, out)
Gdip_DisposeImage(snap), Gdip_Shutdown(pToken)
;Run, %out%
}

Return

Re: Screen Clipper by LearningOne. Can we make standalone?

Posted: 22 May 2021, 15:16
by mikeyww
Example is below.

Code: Select all

#Include q:\vis2\lib\Gdip_All.ahk
out = %A_ScriptDir%\test.png

F3::
MouseGetPos, x1, y1
SoundBeep, 1500, 20
KeyWait, %A_ThisHotkey%
SoundBeep, 1000, 20
MouseGetPos, x2, y2
width := x2 - x1, height := y2 - y1
If (width < 4 && height < 4)
 Return
pToken := Gdip_Startup(), snap := Gdip_BitmapFromScreen(x1 "|" y1 "|" width "|" height)
Gdip_SetBitmapToClipboard(snap), Gdip_SaveBitmapToFile(snap, out)
Gdip_DisposeImage(snap), Gdip_Shutdown(pToken)
Gui, New
Gui, Add, Picture, w250 h-1, %out%
Gui, Show,, Screenshot
Return
This can also be done without using a file: https://www.autohotkey.com/boards/viewtopic.php?p=362354#p362354

Re: Screen Clipper by LearningOne. Can we make standalone?

Posted: 23 May 2021, 20:11
by iilabs
Thank you Mikeyww,

Better late than never! Must be cleaning out your inbox.

Thanks for your dedicated help and support on the other script with the list box. Coming out great and very helpful!