Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File Path
Message
De
08/07/2002 17:35:29
Irv Adams
MSC Managed Care, Inc.
Floride, États-Unis
 
 
À
08/07/2002 12:15:10
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00676185
Message ID:
00676376
Vues:
14
Steven:

Nadya is right, Filer is a good utility and very fast. Here is some code to allow you to access the Filer Object and incorporate this into your program. The following is from a Form I created that searches for certain text and file extensions within Folder(s) and subfolder(s):
DoDefault()
PUBLIC oMyFiler

WITH THISFORM

IF !EMPTY(THIS.Parent.Folder.Value) .and. !EMPTY(THIS.Parent.Extension.Value)

oMyFiler = CREATEOBJECT('Filer.FileUtil')
oMyFiler.SearchPath = Trim(THIS.Parent.Folder.Value)
oMyFiler.FileExpression = Trim(THIS.Parent.Extension.Value)
IF .IncludeSubs.Value=1
  oMyFiler.Subfolder=1
Else
  oMyFiler.Subfolder=0
Endif
IF .Insensitive.Value=1
  oMyFiler.IgnoreCase=1
Else
  oMyFiler.IgnoreCase=0
Endif
IF !EMPTY(THISFORM.SearchText1.Value)
  oMyFiler.SearchText1 = THISFORM.SearchText3.Value
ENDIF
IF !EMPTY(THISFORM.SearchText2.Value)
   oMyFiler.SearchText2 = THISFORM.SearchText3.Value
ENDIF
IF !EMPTY(THISFORM.SearchText3.Value)
   oMyFiler.SearchText3 = THISFORM.SearchText3.Value
ENDIF
			 
oMyFiler.Find(0)
Messagebox("Discovered: " + STR(oMyFiler.Files.Count) + " files, will write to Table for viewing...")

IF !EMPTY(oMyFiler.Files.Count)

  SELECT FRESHFILES
  ZAP
  FOR nFileCount = 1 TO oMyFiler.Files.Count
APPEND BLANK

REPLACE FileTitle   WITH oMyFiler.Files.Item(nFileCount).Path + oMyFiler.Files.Item(nFileCount).Name

REPLACE DateCreated WITH oMyFiler.Files.Item(nFileCount).DateTime
REPLACE DateAccess  WITH oMyFiler.Files.Item(nFileCount).LastAccessTime
REPLACE DateWrite   WITH oMyFiler.Files.Item(nFileCount).LastWriteTime

ENDFOR
THISFORM.ContainrPlus1.GridPlus.Refresh()

Endif
Else
Messagebox("Isufficient information for Search.")
Endif

ENDWITH
HTH,

-Irv.



>I am trying to do some e-mail automation. My challenge is the attachments. The user types the documents to send with the e-mail into a table. I can then build a string from this table data to include the attachments for the e-mail that works just fine. The problem is knowing the file path to the documents. I would like to use some code to search for the document number the user types in and return the file path ito an associated field of the above table. I am not sure this is possible since the documets are scattered over the network in various locations. I have thought about when the document text box loses focus to do the locfile() function on the document number. Only I am afraid the Open Dialog box might be confussing. I just don't know the best approch.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform