Jump to content
MRAJ

Printscreen command not working

Recommended Posts

Hi,

I am running a website and try to take a printscreen and then open mspaint and paste the screenshot. It is working fine when i am running manually on the server logged in, but when i disconnect the server and running through task schedule, mspaint is opening but pasting the screenshot is not happening. Please guide.

Local $oIE = _IECreate($URL,0,1,0)

Local $hWnd = WinWait("","",5)
WinActivate($hWnd)
Sleep(5000)
Send("!{PRINTSCREEN}")
Sleep(2000)
Run("mspaint")
Sleep(2000)
Local $hWnd = WinWaitActive("Untitled - Paint","",5)
WinActivate($hWnd)
Sleep(2000)
ControlClick($hWnd, "", "Afx:c10000:81",2)
Sleep(2000)
ControlSend($hWnd, "", "Afx:c10000:81","^v")

 

Share this post


Link to post
Share on other sites

Hi,

Thanks.

I tried with below script but still its not working.

Local $oIE = _IECreate($URL,0,1,0)

Local $hWnd = WinWait("","",5)
WinActivate($hWnd)
Sleep(5000)
Send("!{PRINTSCREEN}")
Sleep(2000)
Run("mspaint")
Sleep(2000)
Local $hWnd = WinWaitActive("Untitled - Paint","",5)
WinActivate($hWnd)
Sleep(2000)
ControlClick($hWnd, "", "[REGEXPCLASS:Afx:.+:8]",2)
Sleep(2000)
ControlSend($hWnd, "", "[REGEXPCLASS:Afx:.+:8]","^v")

Even i tried with below script that also not working. I am not sure where i am missing. 

Local $oIE = _IECreate($URL,0,1,0)

Local $hWnd = WinWait("","",5)
WinActivate($hWnd)
Sleep(5000)
Send("!{PRINTSCREEN}")
Sleep(2000)
Run("mspaint")
Sleep(2000)

$hWnd = ControlGetHandle ($hWnd, "", "[REGEXPCLASS:Afx:.+:8]")
WinActivate($hWnd)
Sleep(2000)

Sleep(2000)
ControlClick($hWnd, "", "[REGEXPCLASS:Afx:.+:8]",2)
Sleep(2000)
ControlSend($hWnd, "", "[REGEXPCLASS:Afx:.+:8]","^v")

 

Share this post


Link to post
Share on other sites

Works well for me

Local $oIE = _IECreate("google.ca",0,1,0)
Local $hWnd = WinWait("","",5)
WinActivate($hWnd)
Sleep(5000)
Send("!{PRINTSCREEN}")
Sleep(2000)
Run("mspaint")
Sleep(2000)
Local $hWnd = WinWaitActive("[CLASS:MSPaintApp]","",5)
WinActivate($hWnd)
Sleep(2000)
Local $hWnd2 = ControlGetHandle ($hWnd, "", "[REGEXPCLASS:Afx:.+:8]")
MsgBox ($MB_SYSTEMMODAL,"",$hWnd2)
ControlClick($hWnd, "", "[REGEXPCLASS:Afx:.+:8]",2)
Sleep(2000)
ControlSend($hWnd, "", "[REGEXPCLASS:Afx:.+:8]","^v")

 

Share this post


Link to post
Share on other sites

Hi ,

Thanks.

But it is working only when i logged into the server and run manually, when i schedule the script in task scheduler and disconnect the server, then it is not working only empty mspaint is opened but no any screenshot of the page. 

Share this post


Link to post
Share on other sites

...and that is because ... ??? ... there is no screen !!!!
There have to be a screen. Login in the console and it will work as expected. From a remote session, it will have to be showing to someone. So instead of minimizing, resize it ( to a size that won't bother ) and it will work.

Share this post


Link to post
Share on other sites

I didn't get you here what do you mean by resize it ( to a size that won't bother ). Do you mean decrease the size of the screen resolution.

Share this post


Link to post
Share on other sites
On 6/4/2019 at 6:36 AM, MRAJ said:

but when i disconnect the server

Do not disconnect, resize the remote desktop and leave it running. Not even minimized, just running. But resized, still keeps the full desktop canvas, where you see just a section ( due to it been resized.

Share this post


Link to post
Share on other sites

Hi,

Thanks.

Sorry for late reply. I did the same as you suggested, but after sometime, server locked and then the printscreen and pasting is not working on mspaint.

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

×
×
  • Create New...