CALL Write_Image problem

I get error message:
Trouble using disk or printer. (9002) 312 in Main Program

With this code:

BOX KEEP -120, 4100, -40, 112 IN SpectPlot$
CALL Write_Image("JPEG",SpectPlot$,"C:\Users\Owner\My Pictures\Myplot.jpg")

Also fails with destination as a USB stick.
I have bronze TB version downloaded about 2 months ago.
Could my Kaspersky AV SW be the problem, or is there another cause?

Tom M

Follow-up
I now see "JPEG" is not valid for CALL Write_Image. "MS BMP" must be used.
But this does not work for me either.
I am using Windows 7, 64 bit
Tom M

Comments

Saving Boxkeep as BMP

Hello,
I think maybe the path or file name you specified wasn't good.

Anyway, try the following little program, which works under Win7-64bit on Silver 5.33, Gold 5.5b19, and the Bronze demo. Copy the program text below to a text editor and save it somewhere on your disk. It can be .txt or .tru or anything. Then run TB and open the saved file from TB. (Apparently one cannot Ctrl+C from the forum and then Ctrl-V it into an open TB new file and get it to save (gives 9002 error). Don't know why...)

The SUB at the end will take the x-y bounds of the area you want to save, and save to a BMP directly. Saves messing around with boxkeep, etc. Or you can use what you had; it should have worked... just be sure the path\filename is valid.

Hope this helps.
Regards, Miks C.
-----------------------------------

option nolet
! ------------- SET UP SCREEN:
ask pixels xpix,ypix ! FIND OUT how big the screen is
print ,"Screen size in pixels px, py: ";xpix;" ";ypix
set window 0, xpix-1, 0, ypix-1 ! Screen to pixel coords
SET CURSOR 6,1

! ---------------- create something to keep in a boxkeep --------------
width=162
height=100
x=400
y=600
set color 12
box lines x, x+width, y, y+height
plot lines: x, y; x+width, y+height; x, y+height; x+width, y
box keep x, x+width, y, y+height in keep$ !

! ------- Create a filename. Don't need an extention; the SUB will put ".bmp"

ff$="C:\Users\Owner\My Pictures\yet Another image" ! make sure this is a valid path...

CALL BMP_saver(x, x+width, y, y+height, ff$) ! with this SUB, you don't need to box keep

! CALL Write_Image("MS BMP", keep$, ff$) ! or you can use this

! BOX KEEP -120, 4100, -40, 112 IN SpectPlot$
! CALL Write_Image("JPEG",SpectPlot$,"C:\Users\Owner\My Pictures\Myplot.jpg")
! this should have worked...

END

SUB BMP_saver(a,b,c,d,ff$) ! (xl,xr,yb,yt)
! based on mcc JpgSaver.txt 10 Dec 11
! boxkeeps rectangle abcd in bxkp$ and saves it as a BMP file named ff$
q=pos(ff$,".") ! look for an extention
IF q<>0 THEN ff$=ff$[1:q-1]&".bmp" ! change ext to .bmp
IF q=0 THEN ff$=ff$&".bmp" ! put .bmp if no ext there
box keep a,b,c,d in bxkp$
! you can use Irfanview to convert bmp to jpg, tif, etc., if desried
fz=len(bxkp$)
set color 0
print ,"Image file name: ";ff$, "file size: ";fz
CALL Write_Image("MS BMP", bxkp$, ff$)
END SUB