sc0rpi0 Posted August 6, 2008 Posted August 6, 2008 does anyone know of a free, command-line screenshot utility for windows? much appreciated. Quote
moonlit Posted August 6, 2008 Posted August 6, 2008 You don't really need a screenshot app, just right click the command line window and click "Mark", highlight the text you need, then right click (which copies the text to the clipboard). Quote
RogueHart Posted August 6, 2008 Posted August 6, 2008 You don't really need a screenshot app, just right click the command line window and click "Mark", highlight the text you need, then right click (which copies the text to the clipboard). i dont know for sure but judging by his last topic i think he wants a command line utility that when called will take a screenshot of the current screen. seems like hes trying to automate something. Quote
sc0rpi0 Posted August 6, 2008 Author Posted August 6, 2008 i dont know for sure but judging by his last topic i think he wants a command line utility that when called will take a screenshot of the current screen. seems like hes trying to automate something. that is correct. i do not want to copy text out of cmd but to take a screenshot of the current screen. Quote
moonlit Posted August 6, 2008 Posted August 6, 2008 Ahh, my mistake. 'Fraid I can't help on that one then. Quote
warden1337 Posted August 6, 2008 Posted August 6, 2008 um... print screen. then crtl-v in paint. cut it down and voila yous are leetzor. Quote
digip Posted August 6, 2008 Posted August 6, 2008 Look for something alternative to snag it. There are free ones out there. Try this: http://www.shup.com/ Quote
sc0rpi0 Posted August 6, 2008 Author Posted August 6, 2008 Look for something alternative to snag it. There are free ones out there. Try this: http://www.shup.com/ that needs installation (sorry, i forgot to mention that i don't want an app that needs install) and requires using the gui to take a screenshot. RELATED QUESTION #2: Does anyone know how to dump the contents (text, pictures, etc) of the clipboard to a directory using either the command prompt or a 3rd-party program? thanks. Quote
natural_orange Posted August 6, 2008 Posted August 6, 2008 that needs installation (sorry, i forgot to mention that i don't want an app that needs install) and requires using the gui to take a screenshot. RELATED QUESTION #2: Does anyone know how to dump the contents (text, pictures, etc) of the clipboard to a directory using either the command prompt or a 3rd-party program? thanks. if its on vista you can use the "clip" command to send things to or from the clipboard (text). You could probably make an app in c++ or c# pretty quickly using the windows API's. I could make one in c# for you but it would require .NET 2.0 at least. I made one. get it here http://naturalorange.net/uploads/scrnshot.zip If you just run the exe, it will create a screenshot in the format year_month_day_hour_minute_second.png. Otherwise specify the name you want to use (scrnshot.exe filename.png). It requires .NET 2.0 framework. But no installation is needed. Quote
sc0rpi0 Posted August 6, 2008 Author Posted August 6, 2008 if its on vista you can use the "clip" command to send things to or from the clipboard (text). You could probably make an app in c++ or c# pretty quickly using the windows API's. I could make one in c# for you but it would require .NET 2.0 at least. I made one. get it here http://naturalorange.net/uploads/scrnshot.zip If you just run the exe, it will create a screenshot in the format year_month_day_hour_minute_second.png. Otherwise specify the name you want to use (scrnshot.exe filename.png). It requires .NET 2.0 framework. But no installation is needed. thanks a bunch. this is exactly what i was looking for. could i possibly get the source so that i can use it in future projects? besides, i am kind of paranoid about executables that aren't either compiled by me or from an opensource website. despite that you are one of the last people i would be wary of, i can never take safety too far. Quote
natural_orange Posted August 7, 2008 Posted August 7, 2008 Visual Studio 2008 C# Solution: http://naturalorange.net/uploads/scrnshot_source.zip Its very simple, less than 15 lines. Mostly I just modified another project to work on the command line. If you don't have Visual Studio, you can just open the main progam.cs file. Possible Features for the future would be adding a watermark to the image. -------------------------------------------------------------- I'm working on a project that would copy anything from the clipboard to a file. Text/Image/Sound/Files. It's not working yet but I'm looking into it. Quote
sc0rpi0 Posted August 7, 2008 Author Posted August 7, 2008 Visual Studio 2008 C# Solution: http://naturalorange.net/uploads/scrnshot_source.zip Its very simple, less than 15 lines. Mostly I just modified another project to work on the command line. If you don't have Visual Studio, you can just open the main progam.cs file. Possible Features for the future would be adding a watermark to the image. -------------------------------------------------------------- I'm working on a project that would copy anything from the clipboard to a file. Text/Image/Sound/Files. It's not working yet but I'm looking into it. If it's not too much trouble, please send me a copy too! Quote
antirem Posted August 7, 2008 Posted August 7, 2008 do you mean screenshot or video? if its screeshot use print screen. If video i think fraps has a free version right? I am assuming you are doing the remotely since you dont want to install it tho ;) Quote
Tenzer Posted August 7, 2008 Posted August 7, 2008 besides, i am kind of paranoid about executables that aren't either compiled by me or from an opensource website. Why are you running Windows then? ;) Sorry, I couldn't help it. It wasn't meant as flamebait. Quote
PileOfMush Posted August 7, 2008 Posted August 7, 2008 #include <iostream.h> #include <windows.h> #include <stdio.h> int main() { TakeScreenShot("c:\\Screenshot.bmp"); return 0; } void TakeScreenShot(char* filename) { keybd_event(VK_SNAPSHOT, 0x45, KEYEVENTF_EXTENDEDKEY, 0); keybd_event(VK_SNAPSHOT, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); HBITMAP h; OpenClipboard(NULL); h = (HBITMAP)GetClipboardData(CF_BITMAP); CloseClipboard(); HDC hdc=NULL; FILE *fp=NULL; LPVOID pBuf=NULL; BITMAPINFO bmpInfo; BITMAPFILEHEADER bmpFileHeader; do { hdc=GetDC(NULL); ZeroMemory(&bmpInfo,sizeof(BITMAPINFO)); bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); GetDIBits(hdc,h,0,0,NULL,&bmpInfo,DIB_RGB_COLORS); if(bmpInfo.bmiHeader.biSizeImage<=0) bmpInfo.bmiHeader.biSizeImage=bmpInfo.bmiHeader.biWidth*abs(bmpInfo.bmiHeader.bi Height)*(bmpInfo.bmiHeader.biBitCount+7)/8; if((pBuf = malloc(bmpInfo.bmiHeader.biSizeImage))==NULL) { MessageBox( NULL, "Unable to Allocate Bitmap Memory", "Error", MB_OK|MB_ICONERROR); break; } bmpInfo.bmiHeader.biCompression=BI_RGB; GetDIBits(hdc,h,0,bmpInfo.bmiHeader.biHeight,pBuf, &bmpInfo, DIB_RGB_COLORS); if((fp = fopen(filename,"wb"))==NULL) { MessageBox( NULL, "Unable to Create Bitmap File", "Error", MB_OK|MB_ICONERROR); break; } bmpFileHeader.bfReserved1=0; bmpFileHeader.bfReserved2=0; bmpFileHeader.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+bmpInfo.b miHeader.biSizeImage; bmpFileHeader.bfType='MB'; bmpFileHeader.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); fwrite(&bmpFileHeader,sizeof(BITMAPFILEHEADER),1,fp); fwrite(&bmpInfo.bmiHeader,sizeof(BITMAPINFOHEADER),1,fp); fwrite(pBuf,bmpInfo.bmiHeader.biSizeImage,1,fp); } while(false); if(hdc) ReleaseDC(NULL,hdc); if(pBuf) free(pBuf); if(fp) fclose(fp); } This is ripped from somewhere. Things that need fixing: remove MessageBox error output and change the filename so it's more of a datetime thing than hardcoded. Since you asked about it earlier, I'll point out that this contains an example of copying data from the clipboard. Actually, if it's not obvious how this thing works, it presses the printscreen key and then snags the clipboard data to a bitmap. I don't have VC++ or I'd try to fix it and compile it. Good luck. Quote
digip Posted August 7, 2008 Posted August 7, 2008 LPVOIDpBuf=NULL; Just glancing over it looks like this needs to be changed to "LPVOID pBuf=NULL;" Haven't gotten it to work though. I get the following errors ss.cpp: In function `int main()': ss.cpp:6: error: `TakeScreenShot' was not declared in this scope ss.cpp:47:30: warning: multi-character character constant Quote
sc0rpi0 Posted August 7, 2008 Author Posted August 7, 2008 do you mean screenshot or video? if its screeshot use print screen. If video i think fraps has a free version right? I am assuming you are doing the remotely since you dont want to install it tho ;) 1. screenshot (must be automated though---printscreen is not---i coded up a way to automate the printscreen button but can't figure out how to automatically retrieve the screenshot from the clipboard 2. Yes, I am designing this to be remotely done Quote
PileOfMush Posted August 7, 2008 Posted August 7, 2008 I fixed two missing spaces. I was trying to format the code to look pretty and probably broke it. (FILE *fp=NULL; LPVOID pBuf=NULL;) haha To sc0rpi0: I'm not sure if I made it clear enough before... when you run this, you don't have to push print screen... it does it automatically and saves out a bitmap file. In fact, if you wanted an all-in-one tool to save the contents of clipboard to a file, THEN grab a screenshot, you can insert some code to grab from the clipboard right before it does the key-down/key-up events on the Printscreen button. I just wish I had a compiler available so I could fix it up and build it. Quote
digip Posted August 8, 2008 Posted August 8, 2008 I fixed two missing spaces. I was trying to format the code to look pretty and probably broke it. (FILE *fp=NULL; LPVOID pBuf=NULL;) haha To sc0rpi0: I'm not sure if I made it clear enough before... when you run this, you don't have to push print screen... it does it automatically and saves out a bitmap file. In fact, if you wanted an all-in-one tool to save the contents of clipboard to a file, THEN grab a screenshot, you can insert some code to grab from the clipboard right before it does the key-down/key-up events on the Printscreen button. I just wish I had a compiler available so I could fix it up and build it. Download Mingw. It's free. http://www.mingw.org/node/24 I still can't get it to compile properly, and the one that does compile, doesn't produce anything, so this code is either incomplete, or just not working the way it is. Quote
sc0rpi0 Posted August 8, 2008 Author Posted August 8, 2008 I fixed two missing spaces. I was trying to format the code to look pretty and probably broke it. (FILE *fp=NULL; LPVOID pBuf=NULL;) haha To sc0rpi0: I'm not sure if I made it clear enough before... when you run this, you don't have to push print screen... it does it automatically and saves out a bitmap file. In fact, if you wanted an all-in-one tool to save the contents of clipboard to a file, THEN grab a screenshot, you can insert some code to grab from the clipboard right before it does the key-down/key-up events on the Printscreen button. I just wish I had a compiler available so I could fix it up and build it. sorry...my miscommunication. I was talking about the script *I* was trying to make. In my script, I worked out a way to automate the Printscreen button but can't figure out a way to intercept the shot from the clipboard. I am using autoit (a noob script language) for this. Quote
antirem Posted August 8, 2008 Posted August 8, 2008 Any reasons you just dont want to use a trojan with vnc or something? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.