Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to take a snapshot in script

Status
Not open for further replies.

Xianbo

Technical User
May 24, 2007
5
FR
Hello, I am a new Aspect script user (Procomm Plus 4.8). I am trying to take a snapshot and save the image with paint. The problem is when I use "sendvkey 0x2C", there is nothing in the clipboard.
Here is my script:

proc DUMeter
String Cmd
strfmt Cmd "c:\Program Files\DU Meter\DUMeter.exe"
run Cmd
pause 3
sendvkey 0x0179 ; Shift + F10
mspause 500
sendvkey 0x028 ; Down Arrow key
mspause 500
sendvkey 0x028 ; Down Arrow key
mspause 500
sendvkey 0x028 ; Down Arrow key
mspause 500
sendvkey 0x028 ; Down Arrow key
mspause 500
sendvkey 0x028 ; Down Arrow key
mspause 500
sendvkey 0x0D
mspause 500
sendvkey 0x0D
pause 300 ; Wait 5 minutes for DL throughput
sendvkey 0x0D
mspause 500
sendvkey 0x2C ; Print Screen key
mspause 500
sendvkey 0x443 ; ALT + F4
mspause 500
sendvkey 0x0179 ; Shift + F10
mspause 500
sendkey 'E'
mspause 500
endproc
 
Here is the script I use for saving the image:

proc PaintSave
param String ImageName
String Cmd
integer TaskId
strfmt Cmd "pbrush.exe"
run Cmd TaskId
while taskexists TaskId
yield
endwhile
pause 2
sendvkey 0x0256 ; Ctrl+V
mspause 500
sendkey ALT 'F'
mspause 500
sendkey 'E'
mspause 500
sendvkey 0x08 ; Backspace
strtoclip ImageName
sendvkey 0x0256 ; Ctrl+V
mspause 500
sendkey ALT 'E'
pause 1
sendkey ALT 'F'
mspause 500
sendkey 'Q'
mspause 500
endproc
 
In the main script, I call theses functions:

DUMeter()
pause 10

PaintSave(ImageName)
pause 10

The script works, but in the end I have nothing in the saved image.
 
If you run Paintbrush manually after the script, are you able to paste in the image? If so, the problem may be these lines in your script:

while taskexists TaskId
yield
endwhile

Your script will sit in this loop as long as Paintbrush is running, so I would comment them out and see what results you receive.

 
Thanks for your answer knob, I remove these three lines in my script, but the result is the same. I also tried to run Paintbrush manually after the DUMeter script, but I can not paste in the image.
 
OK, so it looks to me like the issue is in saving the data to the clipboard. I tried running a script with just sendvkey 0x2C and that doesn't work for some reason, but pressing Print Screen in the same application does save the image to the clipboard.

Are you able to use Print Screen manually to get the data you want? The reason I ask is due to the below note in the help file and your launching an executable file:

Keystrokes cannot be sent to a DOS compatibility window.

I take it the other sendvkey commands sent to the application work OK?

 
I can use Preen Screen manually to save image to the clipboard. By the way, I added a script to use a software able to take and save a screenshot. Now I can save image without using sendvkey 0x2C.
Thank you for your help knob.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top