Normal Topic Saving documents (Read 761 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Saving documents
Aug 23rd, 2016 at 9:09pm
Print Post Print Post  
I have a need to save a .pdf file  from Sesame.  I know that @AsynchShell() will open and run a file.  I was wondering if there is a command in Sesame to save the file.

Is that possible?
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Saving documents
Reply #1 - Aug 23rd, 2016 at 9:37pm
Print Post Print Post  
There are several commands in Sesame that save files. How are you obtaining or producing a .pdf file so that it needs to be saved from Sesame?

Generally, pdf files are produced by writing to a PDF printer driver. Most of these allow you to either send the result directly to a printer or save the result as a .pdf file.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Saving documents
Reply #2 - Aug 24th, 2016 at 12:54pm
Print Post Print Post  
The PDF file is being created by scanning document(s) directly to the file, outside of Sesame.  I need to attached the scanned file to up to 100 different Sesame records via a unique element in the records.  This is so I can access the records from any of the different records.

I can envision a mass update that would save the file for each record setting the file name using the characters from the unique element data.

Once that's done, I can then easily access the file from any record.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Saving documents
Reply #3 - Aug 24th, 2016 at 1:57pm
Print Post Print Post  
If you are saving the file directly from the scanning software, there is no need to "save the file" from in Sesame. The file is already saved and exists in your file system. You will need Sesame to reference the path to the file.

If your scanner software is saving the file to c:\MyDocuments\scanned_234.pdf, you could have an element on your form for the PDF file that contains the string representing the path "c:\MyDocuments\scanned_234.pdf". If you named the file uniquely, setting this element to the path could be automated using mass update or on application / form open programming. Once the element has the path, you can use PDF viewing software to display the PDF from Sesame.

If having the PDF file exist outside the Sesame application is cumbersome, you can use a "base 64" converter to convert the PDF file into ASCII, and then @insert the file into an element, thereby storing all of the PDF content actually in the record. It would need to be restored as a PDF before it could viewed, each time it is viewed. Your application file will grow quite large (base 64 is 1/3 larger than the original binary) and there will certainly be a performance hit, but it will result in a central container. In this case, you would need to "save the file" from Sesame in SBasic, to have a base 64 file to convert back into a PDF to display with a pdf viewer. SBasic has a full complement of file commands, including FileOpen, FileClose, and FileWrite.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Saving documents
Reply #4 - Aug 24th, 2016 at 5:42pm
Print Post Print Post  
I may not have been clear in what i'm trying to do.  I have an element in my record to which I keep adding document names with a semicolon between them.  I then use @PopupMenu() and @asynchshell() to open the documents as needed. 

This works fine, but I've recently been playing with DirectoryList and @Asynchshell() to access the documents.  When using the DirectoryList command, I also use @SearchStringArray to select only the directory files that are associated with the open record in Sesame.  I do that by using the unique info in one element for sorting.  This has the advantage of reducing the amount of work the clerk needs to do (doesn't need to write in the document name in the sesame element and reduces the potential of typo's.

I have a method to add one name to each of the 100 sesame records, but the file name is not connected to the unique element as all 100 records are using the files generic name.

I realize my proposed method will create multiple pdf files, but I think the advantages make it worthwhile.  But, I can't figure out a way to same the file with multiple names other than to manually save it to each new name, which is unwieldy.

  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Saving documents
Reply #5 - Aug 24th, 2016 at 6:35pm
Print Post Print Post  
So you are not trying to save a file, so much as you are trying to copy a file from one path to another?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Saving documents
Reply #6 - Aug 25th, 2016 at 12:29pm
Print Post Print Post  
Yes, and rename the file at the same time.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Saving documents
Reply #7 - Aug 25th, 2016 at 12:46pm
Print Post Print Post  
You can either let the OS take care of it using @shell or any of its variations, or you can use the FileOpen command to read the file and write the file to a new location (path and name). @Shell is probably the simpler solution, but may not be quite as elegant, in that a command line window will appear briefly. FileOpen is a bit cleaner, but does involve a bit more SBasic programming.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged