Howzit,
Has anyone come up against this problem before. I am starting to think it may be a SpiderMonkey version problem but can't certain at this stage, since I have no way of determining said version. I am rambling... the code I am using is
This code works like a charm on SC6.2 thanks to the getAttachmentByteString function from the KMUtils library in SC6.2. In SC6.1 this library function fails complaining about 'uncompress' being unrecognised.Code:function saveAttachment(app,topic) { var att = new SCFile("SYSATTACHMENTS"); var rc = att.doSelect("application=\""+app+"\" and topic=\""+topic+"\""); if (rc == RC_SUCCESS) { var path = "d:\\temp\\"+att.filename; var binary = "b"; function getAttachmentByteString(strSCFile, strId, strUID) { var fAttachments = new SCFile("SYSATTACHMENTS"); var rc = fAttachments.doSelect("application=\""+strSCFile+"\" and topic=\""+ strId +"\" and uid=\""+strUID+"\""); var bCompressed; if( rc == RC_SUCCESS ) { var binaryStr = ""; rc = fAttachments.getFirst(); bCompressed = fAttachments.compressed; while( rc == RC_SUCCESS) { binaryStr += fAttachments.data; rc = fAttachments.getNext(); } } return bCompressed ? uncompress(binaryStr) : binaryStr; } var output = writeFile(path,binary,getAttachmentByteString(app,topic,att.uid)); //print("The file written was: "+output+" large."); } }
Any thoughts?


Reply With Quote
Bookmarks