Hello,
I have to do a simple task: to save an image which i obtain from a scan using a pluguin.
I got the image but i couldnt save it
i use the code as follows but i couldnt solve my problem:
var srcArray = plugins.scannerPro.GetTwainSources()
var scanObject = plugins.scannerPro.QuickScan(‘license_key’,srcArray[0],‘jpg’);
var image = plugins.images.getImage(scanObject);
var tempFile = plugins.file.createFile(‘fotoreceta’,‘.jpg’)
plugins.file.writeFile(tempFile, image)
var ok = plugins.file.copyFile(tempFile,‘O:\Recetas’)
‘O:\Recetas’ is the path where i want to save the image.
Thanks for your help
why are you using a temp file and then copy it?
why not directly create the output file you want?
edit also use the forward slash: / instead of backward \ in file paths.
Problem solved:
var f = plugins.file.createFile(nombre)
if (!plugins.file.writeFile(f, scanObject))
application.output(‘Failed to write the file.’)
var path = ‘o:/Recetas/’ + nombre
var ok = plugins.file.copyFile(f,path)
thank you
you’re still writing it twice…
Thank you again.
var scanObject = plugins.scannerPro.QuickScan(‘license_key’,srcArray[0],‘jpg’);
var f = plugins.file.createFile(path);
if (!plugins.file.writeFile(f, scanObject))
application.output(‘Failed to write the file.’);