Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Zipping files from inside VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01222560
Message ID:
01222810
Vues:
39
The code should work in Windows XP, not sure about other OS versions. In the long thread I pointed you to there were questions of legality of using this code still, I think, unresolved.

>Back to using the shell object... a little experimenting has shown me this...
>
>If the full path is there, not just the relative path, there is no error and it seems to work.
>i.e. lcDataPath='C:\VFP9APPS\CUSTNAME\DATA\'
>not lcDataPath='DATA\'
>
>Now should I determine the version of the operating system that would allow this? or would a simple try catch finally block around the creation of the shell object be sufficient i.e. the code would be thus
>
>llProceed=.t.
>try
>  oShell=CREATEOBJECT("shell.application")
>catch
>  llProceed=.f.
>endtry
>
>if llProceed
>   *-put my code in here that uses oShell to zip files..
>else
>   =messagebox("Unable To Create System Shell Object",64,"CANNOT ZIP FILES")
>endif
>
>return llProceed
>
>The above shell would it work?
>
>TIA,
>Mike
>
>
>----------------------------
>BTW here is the code that I have tested and it seems to work. (Excluding discussion above.)
>
>IF TYPE('oApp')='O'
>	lcDataPath=oApp.DataLocn
>ELSE
>	lcDataPath='DATA'
>ENDIF
>
>lcDataPath=SYS(5)+CURDIR()+ADDBS(lcDataPath)
>lcZipFileName=lcDataPath+'ArchiveFIle_'+TTOC(DATETIME(),1)+".ZIP"
>strtofile(chr(0x50)+chr(0x4B)+chr(0x05)+chr(0x06)+replicate(chr(0),18),lcZipFileName)
>oShell=CREATEOBJECT("shell.application")
>FOR EACH ofile IN oShell.NameSpace(lcDataPath).items
>	IF LEFT(oFile.name,2)='A_'
>		WAIT WINDOW "Archiving File: " + oFile.Name + ' to ' + lcZipFileName NOWAIT
>   		oShell.NameSpace(lcZipFileName).copyhere(ofile)
>   		ERASE (oFile.name)
>   ENDIF
>ENDFOR
>WAIT clear
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform