Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.visual-basic > #18944
| Newsgroups | it.comp.lang.visual-basic |
|---|---|
| Date | 2016-12-29 16:28 -0800 |
| References | <o43643$ha1$1@gioia.aioe.org> |
| Message-ID | <9c017934-a1a0-41dc-9839-e5c4e213d0e3@googlegroups.com> (permalink) |
| Subject | Re: aiuto su codice vbs |
| From | Luca D <antaniserse@yahoo.it> |
On Thursday, December 29, 2016 at 3:20:53 PM UTC+1, Tommy wrote:
[CUT]
> è possibile riscrivere il codice in modo più "sintetico" ovvero anzichè
> ripetere 9 blocchi di codice quasi uguali, averne uno solo che dice che
> qualora una qualunque di quelle 9 cartelle sia presente su CD va
> ricopiata su HD?
>
> ho provato con
> if Fso.FolderExists ("D:\IMAGES") or ("D:\DICOM") or ecc. ecc.
>
> ma non funzionava
Un semplice OR dovrebbe funzionare, ma devi ripetere l'istruzione completa ("Fso.FolderExists(xxx) or Fso.FolderExists(yyy) or ...."
In ogni caso, puoi renderla più compatta facendo una piccola funzione e un ciclo, ad esempio con:
dim fso, folders, i
Set fso = CreateObject("Scripting.FileSystemObject")
folders = Array("D:\000","D:\CDSURF","D:\DATA","D:\DICOM","D:\IMAGES","D:\studies","D:\_STUDIES","D:\study000")
for i = 0 to UBound(folders)
If CheckFolder(folders(i)) Then CopiaCDsuHD
next
Function CheckFolder(path)
CheckFolder = fso.FolderExists(path)
End Function
Back to it.comp.lang.visual-basic | Previous | Next — Previous in thread | Next in thread | Find similar
aiuto su codice vbs Tommy <barta@quipo.it> - 2016-12-29 15:20 +0100
Re: aiuto su codice vbs Luca D <antaniserse@yahoo.it> - 2016-12-29 16:28 -0800
Re: aiuto su codice vbs Luca D <antaniserse@yahoo.it> - 2016-12-29 16:30 -0800
Re: aiuto su codice vbs Tommy <barta@quipo.it> - 2017-01-02 21:30 +0100
csiph-web