Normal Topic Image Box for documents (Read 782 times)
Faithlee
Member
*
Offline



Posts: 8
Joined: Mar 4th, 2011
Image Box for documents
Dec 20th, 2011 at 11:56pm
Print Post Print Post  
I would like to have the ability like "image box" that can display documents (ie: .pdf, MS Word/Excel, or other documents). 

Currently I have to save documents as .pdf, then save as .jpg before it can use in image box.

Thank you!
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Image Box for documents
Reply #1 - Dec 21st, 2011 at 4:01pm
Print Post Print Post  
Faithlee,

Someone here might know exactly how to do this, but in my opinion, a better option is to simply have a text field on your form to store the path to the file. Then add a command button to 'launch' the file in it's default viewer.

This gives the user much more control over the file once it's being viewed.

Example:

Create a text LE called 'PathToFile'. Create a Command Button next to it with code similar to this:

Var vLaunchFile as int

vLaunchFile = @shell(PathToFile)
if vLaunchFile = 0 then writeln("Oops. Couldn't launch the file.")

You could also replace @shell for @asynchshell.

Hope that helps.

Steve



  
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Image Box for documents
Reply #2 - Dec 21st, 2011 at 4:06pm
Print Post Print Post  
Faithlee,

Why not let Sesame have the operating system that you use do the heavy lifting.

If your operating system is associated with the type of file you are trying to open just use something like @AsynchShell to call it.

In my case I have a specific folder that I store my word files and a specific folder were I store pdf and other set places for other types.

I then have Sesame using Sbasic on a button, open it.
You can also have Sesame name it and put it in the directory and have sesame check and tell you if a document is available when you enter the record.

In my code example below it checks to see if the document is there and opens it if it is.

Var n as int

iF      FileExists(@ClientLocalValue("pathVariable")+"sesame\script\done\"+ptid+"script.
pdf") // needs to be changed based on working directory

// opens and displays the pdf
n = @AsynchShell(@ClientLocalValue("pathVariable") + "sesame\script\done\" + ptid +"script.pdf")

Let me know if you need additional clarification.

** Steve responded while I was typing so this is pretty much a duplicate response to his.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Image Box for documents
Reply #3 - Dec 21st, 2011 at 4:19pm
Print Post Print Post  
BobScott,

Yes, we replied at the same time, but you're response was much more elegant. Wink
  
Back to top
IP Logged
 
Faithlee
Member
*
Offline



Posts: 8
Joined: Mar 4th, 2011
Re: Image Box for documents
Reply #4 - Dec 26th, 2011 at 10:30pm
Print Post Print Post  
Thank you BobScott and Steve. 

If I can't find another way, then I will consider adding a text field as Steve has suggested.  Right now, I think it is not as user friendly.

I really like how the image box allows users to find the file and link to that file, without having the users typing in the path. 

Again, I really appreciate all your responses!
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Image Box for documents
Reply #5 - Dec 27th, 2011 at 3:22am
Print Post Print Post  
Don't forget that you can program a text box (or button) to pop open a file browser using @LocalFileDialog() and @ServerFileDialog() commands.

Also, you can drag a file from 'My Computer' into an LE in Sesame and it will record the path to the file in that field. Super easy.
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Image Box for documents
Reply #6 - Dec 27th, 2011 at 2:26pm
Print Post Print Post  
Faithlee,

The issue with a thumbnailed application viewer is not in the path to the file, or its resemblance to an image. The issue is in reading and interpreting an unknown file format so as to render that image. There are literally hundreds of thousands of file formats, many unique to their editor/viewer. Some are so unique as to be the proprietary property of the company that provides the editor or viewer. To give Sesame the ability to preview or thumbnail any file you throw at it, without regard to the format of that file, we would need to include libraries of routines that know how to read, interpret, and draw, virtually every kind of file there is. Even the operating system (I assume Windows of some ilk), needs to use the actual application, or shared library, from the company that provides that format, to render the thumbnails that appear in Windows Explorer. And, with all of Microsoft's resources, many formats are still rendered with generic images, rather than an actual preview.

That being said, you might consider using a set of representational images, rather than thumbnails or previews of that particular documents. For example, you can keep a list of all of the spreadsheet format extensions you intend to support: (.xls, .xlsx, etc..) and keep a static image of a grid or speadsheet. When the user selects a file that has any of the spreadsheet extensions you have in your list, your code displays the spreadsheet static image. You can do the same thing for other document types. That way there is no need to preview (read, imterpret, render, miniaturize) each and every document format you might want to support, and your users get a nice graphical representation of the file.
  

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