How to paste clipboard to paint?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AtleastItried
Posts: 51
Joined: 03 Mar 2017, 04:51

How to paste clipboard to paint?

03 Nov 2017, 12:53

I want to paste an image from my clipboard to a new paint window. My problem is, that if the image is smaller that a certain size, thre will be a white border left. Is there an easy way to get rid of that?
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: How to paste clipboard to paint?

03 Nov 2017, 13:02

Simply re-scale the size of a new window to 1x1 px. Once you paste a new content to it it will be enlarged to its captured size.
Beside that you could use GDI+ to create an image from a variable/the clipboard without using MSPaint.
AtleastItried
Posts: 51
Joined: 03 Mar 2017, 04:51

Re: How to paste clipboard to paint?

03 Nov 2017, 13:10

BoBo wrote:Simply re-scale the size of a new window to 1x1 px. Once you paste a new content to it it will be enlarged to its captured size.
Beside that you could use GDI+ to create an image from a variable/the clipboard without using MSPaint.
Is there an easy command to do that to a paint window? If I simply make it smaller the drawing area stays the same.
User avatar
TheDewd
Posts: 1513
Joined: 19 Dec 2013, 11:16
Location: USA

Re: How to paste clipboard to paint?

03 Nov 2017, 14:34

Example

Code: Select all

#SingleInstance, Force

MainAppTitle := "Untitled - Paint ahk_class MSPaintApp ahk_exe mspaint.exe"
PropertiesTitle := "Image Properties ahk_class #32770 ahk_exe mspaint.exe"

F1::
    ControlSend, ahk_parent, ^e, % MainAppTitle ; Open "Image Properties" window
    WinWait, % PropertiesTitle ; Wait for window to appear
    Control, Check,, Button8, % PropertiesTitle ; Choose "Pixels" as Unit
    ControlSetText, Edit1, 1, % PropertiesTitle ; Set Width to 1
    ControlSetText, Edit2, 1, % PropertiesTitle ; Set Height to 1
    ControlSend, Button3, {Enter}, % PropertiesTitle ; Trigger "OK" button
    WinWaitClose, % PropertiesTitle,, 1 ; Wait for window to close
    Sleep, 100 ; Wait 100 milliseconds
    Send, {Alt Down}{PrintScreen}{Alt Up} ; Copy image of active window
    ControlSend, ahk_parent, ^v, % MainAppTitle ; Paste copied image to mspaint
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], macromint, peter_ahk, Rauvagol, Spawnova, wineguy and 293 guests