MRAJ Posted June 4, 2019 Share Posted June 4, 2019 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") Link to comment Share on other sites More sharing options...
Nine Posted June 5, 2019 Share Posted June 5, 2019 Ms Paint control changes at every instance, so you must use something like : $hWnd = ControlGetHandle ($hWnd, "", "[REGEXPCLASS:Afx:.+:8]") to get the right handle... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
MRAJ Posted June 6, 2019 Author Share Posted June 6, 2019 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") Link to comment Share on other sites More sharing options...
Nine Posted June 6, 2019 Share Posted June 6, 2019 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") “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
MRAJ Posted June 6, 2019 Author Share Posted June 6, 2019 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. Link to comment Share on other sites More sharing options...
argumentum Posted June 6, 2019 Share Posted June 6, 2019 ...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. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
MRAJ Posted June 7, 2019 Author Share Posted June 7, 2019 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. Link to comment Share on other sites More sharing options...
argumentum Posted June 7, 2019 Share Posted June 7, 2019 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. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
MRAJ Posted June 25, 2019 Author Share Posted June 25, 2019 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. Link to comment Share on other sites More sharing options...
argumentum Posted June 25, 2019 Share Posted June 25, 2019 6 hours ago, MRAJ said: but after sometime, server locked then, if you can, auto-login to the console session and shadow that session. If that is not possible, I have no other solution Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now