Newbie trying to learn batch files...

phantom1975

MrExcel MVP
Joined
Jun 3, 2002
Messages
3,962
I thought what I am trying to do is relatively easy, but I can't find a thing anywhere on the internet to help me out here. I'm looking for an answer and possibly a forum that rocks the house like this one for my silly batch file.

Several times a day at work, my reps have to do a screen print. So they hit their printscreen button, open WordPad, paste it, and print. Should be easy enough to automate this. Now I know that there are a billion freeware titles out there, but as usual, nothing can be installed on these computers. I have been able to get far enough in a batch file to get WordPad open. I don't know how to paste the contents of the clipboard into the new open document. It would really be nice if the print window opened immediately after the paste. So those of you that are familiar with this, please stop laughing at me and point me in the right direction. I have nothing to offer buy some stale Skittles that are under my couch cushions and my undying affection.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
As far as I know there isn’t a native way to emulate pressing print screen either with batch files or vbscript. I tried something similar before and had no luck. The only way I could see was to use VB but if you had that there wouldn’t be a problem.

Maybe you could get it down to two buttons? Print screen then a further button to print it out.


Do you use word?

If so you could try using an auto_open macro in that to either handle an argument that you provide on the command line (if you can do that with word – I don’t know) or alternatively create a dummy file that word uses as a flag to show that there’s a picture in the clipboard. So:

-Press print screen
-Call a batch file/vbs file that you have a shortcut to on the start menu with a keyboard shortcut assigned
-Scipt/Batch creates dummy file in set location (e.g. empty text file called “screen-grab.txt”)
-Word auto-open macro looks in specified location for that file
-Word can then paste from the clipboard and print (adjusting margins if necessary)
-Word deletes the dummy text file and closes itself

You’d probably want a folder for each user or save it somewhere on their local drive to save confusion/overwriting.

That’s the only way I can think of doing it although I’m sure someone with a bit more nouse will come along and correct me.

Hope this helps

Nick
 
...Several times a day at work, my reps have to do a screen print. So they hit their printscreen button, open WordPad, paste it, and print...
~Phantom1975

OK - I'll bite since I'm curious. What's going on that a MrExcel MVP can't figure sumpin' better'n automating a process that, at least on the surface, seems wicked inefficient? :huh:
 
Isn't there a "SendKeys" command?

There is but it doesn't work. Or possibly it just doesn't work outside of the application that uses it.

Unless someone can prove me wrong which would be nice.

Nick
 
...Several times a day at work, my reps have to do a screen print. So they hit their printscreen button, open WordPad, paste it, and print...
~Phantom1975

OK - I'll bite since I'm curious. What's going on that a MrExcel MVP can't figure sumpin' better'n automating a process that, at least on the surface, seems wicked inefficient? :huh:

I just KNEW someone would ask. There are approx. 120 workstations that have very limited software on them and they cannot download any software. A Word or Excel macro would do the job just perfectly, but aren't available. So I have to stick with what comes stocked with Windows.

I am trying to do this for two reasons. First, I will pull out whatever remaining hair I have if I have one more person tell me they just don't understand how to do the screen print. The second is that I never got around to learning DOS and I figure that I could come up with some practical uses for batch files if I knew how to write them.

Besides, I have to find a new forum to be the newbie that asks too many questions.
 
Isn't there a "SendKeys" command?

There is but it doesn't work. Or possibly it just doesn't work outside of the application that uses it.

Unless someone can prove me wrong which would be nice.

Nick

Every search that I have done indicates that you have to use a special program to use SendKeys.
 
Billy,

If the machines have WScript or CScript (and I will be shocked if they don't). Then I would think you could adapt the sample script here.

I'm afraid I haven't the time do try it myself (though I'm itchin' to). But I think the main challenge will lie in getting a handle on the window you want to printscreen and doing a SENDKEYS that does the printscreen of the desired application. I don't know if SCRIPT offers direct access to the clipboard or if you'd have to try a SendKeys "^V" or something.

Best of luck,
 

Forum statistics

Threads
1,222,710
Messages
6,167,784
Members
452,141
Latest member
beraned1218

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top