Normal Topic Showing a list of files from a directory (Read 603 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Showing a list of files from a directory
May 12th, 2016 at 5:20pm
Print Post Print Post  
Our company creates files (excel, word, .pdf, etc) and keeps them in a certain directory on our network.  The files have different names but our convention is use a standard six digit designation to begin the name of each file.  For example, 3535AA Layout.xls or 3535AA Inspection Report.doc.

It would be real convenient if I were able to click on a command button in a Sesame record and have a list of the files that start with the six digits. 

I would then like to click on one of the file names and have sesame open the file (in word, excel, etc).

Is something like this possible?
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2484
Joined: Aug 20th, 2003
Re: Showing a list of files from a directory
Reply #1 - May 12th, 2016 at 5:48pm
Print Post Print Post  
Hi Paul,

You can use @LocalListDirectory() to get a StringArray list of all files in that directory.

Then use @SearchStringArray() to get just the files from that list that match the 6 digit designation.

Then use @PopupMenu(), or one of the other options, to let the user pick what file they want to open.

Then use @ASynchShell() to pass the path and filename to the system so that the system can open it with the default program for that file extension, ex: .doc will open with Word, .xls with Excel, etc.

Then sit back, kick your feet up and test your command button.

-Ray
« Last Edit: May 12th, 2016 at 8:35pm by Ray the Reaper »  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Showing a list of files from a directory
Reply #2 - May 12th, 2016 at 8:26pm
Print Post Print Post  
Thanks, Ray

I'll give it a try.

  
Back to top
 
IP Logged
 
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Re: Showing a list of files from a directory
Reply #3 - May 13th, 2016 at 6:55pm
Print Post Print Post  
Ray, thanks for the help.  The programming (below) was easy once you pointed out what to do.

var DirectoryList as string
var vDCNumber as string
var vSortedList as string
var vShowList as string
var vTemp as Int

vDCNumber=@Left(DiaCom P\N,4)

PopupSelectPosition(4, @XPos(ThisElement)-200, @YPos(ThisElement))


     directoryList = @LocalListDirectory("F:/sesame Docs/TS DOC Layouts")
     
     vSortedList = @SearchStringArray(directoryList,vDCNumber+"..")
     
     vShowList=@PopupChoiceList(vSortedList,"SELECT A DOCUMENT TO VIEW")

     If @Len(vShowList)>0
     {
           vTemp = @ASynchShell("F:\sesame docs\ts doc Layouts\"+vShowList)
     }
  
Back to top
 
IP Logged