[comp.sys.ibm.pc] shift-print sreen from .bat file

kwongj@caldwr.UUCP (James Kwong) (11/05/88)

Does anyone know of a way to get a .bat file to do a 
shift-print screen??

Thank you in advance
-- 
James Kwong  Calif. Depart. of H2O Resources, Sacramento, CA 95802
caldwr!kwongj@ucdavis.edu(Internet) ...!ucbvax!ucdavis!caldwr!kwongj (UUCP)
The opinions expressed above are mine, not those of the State of California or the California Department of Water Resources.

hollen@spot.megatek.uucp (Dion Hollenbeck) (11/05/88)

From article <421@caldwr.UUCP>, by kwongj@caldwr.UUCP (James Kwong):
> Does anyone know of a way to get a .bat file to do a 
> shift-print screen??
> 
Create a .com program which is run by your .bat file to do it for you.
The easiest way is with debug.

A> debug <CR>

- A100 <CR>				assemble at location 100

xxxx:0100   INT 5 <CR>			software interrupt 5
xxxx:0102   RET <CR>			program return
xxxx:0103   <CR>			end entering assembly

- RCX					open CX register
CX 0000					debug giving contents of CX
:3 <CR>					you enter file length

- N PRTSC.COM				you enter file name

- W					you tell debug to write file

- Q					quit debug


When you run the file prtsc.com, it will invoke in a software
fashion the interrupt 5 vector which is the normal print screen
vector.  This is normally invoked by the keyboard handler when
you do the SHIFT-PRTSC combo.


	Dion Hollenbeck             (619) 455-5590 x2814
	Megatek Corporation, 9645 Scranton Road, San Diego, CA  92121

                                seismo!s3sun!megatek!hollen
                                ames!scubed/

cramer@optilink.UUCP (Clayton Cramer) (11/08/88)

In article <421@caldwr.UUCP>, kwongj@caldwr.UUCP (James Kwong) writes:
> Does anyone know of a way to get a .bat file to do a 
> shift-print screen??
> 
> James Kwong  Calif. Depart. of H2O Resources, Sacramento, CA 95802

Not directly, but you can write a program to generate an INT 5, which
is how Shift Prt Sc is done.

-- 
Clayton E. Cramer
..!ames!pyramid!kontron!optilin!cramer

rargyle@wsccs.UUCP (Bob Argyle) (11/10/88)

In article <394@megatek.UUCP>, hollen@spot.megatek.uucp (Dion Hollenbeck) writes:
> A> debug <CR>
> - A100 <CR>				assemble at location 100
> xxxx:0100   INT 5 <CR>			software interrupt 5
> xxxx:0102   RET <CR>			program return

this is a very good way to lose control of the machine:  what is on the
stack to return to? NOTHING!  
use INT 20 instead of RET, or JMP 0 if you don't want to be
'obsolescent' (it's MS-DOS we're talking here, not OS/2); if there is 
BY CHANCE a zero on the stack then the above code will work.  Not the
sort of thing to depend on.
-- 
                              Bob Argyle @ wsccs
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
!          Has SIGPLAN approved _your_ .signature and .plan files?            !
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

Ralf.Brown@B.GP.CS.CMU.EDU (11/11/88)

In article <772@wsccs.UUCP>, rargyle@wsccs.UUCP (Bob Argyle) writes:
}In article <394@megatek.UUCP>, hollen@spot.megatek.uucp (Dion Hollenbeck) writes:
}> A> debug <CR>
}> - A100 <CR>                           assemble at location 100
}> xxxx:0100   INT 5 <CR>                        software interrupt 5
}> xxxx:0102   RET <CR>                  program return
}
}this is a very good way to lose control of the machine:  what is on the
}stack to return to? NOTHING!  
}use INT 20 instead of RET, or JMP 0 if you don't want to be
}'obsolescent' (it's MS-DOS we're talking here, not OS/2); if there is 
}BY CHANCE a zero on the stack then the above code will work.

As a matter of fact, there is ALWAYS a zero on the stack, because DOS pushes
it there just before transferring control to the program.

Actually, both INT 20h and JMP 0 are now officially frowned upon, you should
be using INT 21h/AH=4Ch (but since when has that stopped any programmer?)
--
UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=-=-=- Voice: (412) 268-3053 (school)
ARPA: ralf@cs.cmu.edu  BIT: ralf%cs.cmu.edu@CMUCCVMA  FIDO: Ralf Brown 1:129/31
Disclaimer? I     |Ducharm's Axiom:  If you view your problem closely enough
claimed something?|   you will recognize yourself as part of the problem.

jcw@jwren.UUCP (John C. Wren) (11/14/88)

Actually, the RET is perfectly legal.  DOS states that a .COM file is
executed via a call.  Thus, when you return, you return back into DOS
who is expecting it.  However, a more correct way is to use function
04ch in AH, via INT 21.  By loading AL (should you need to), you can 
return a result code that the batch file can check (via the ERRORLEVEL
mechanism.)  INT 20 is considered obsolete, as is jumping to 0, and
using AH=0, via INT 21.

					John Wren (jcw@jwren)