Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.lang.visual-basic > #18944

Re: aiuto su codice vbs

X-Received by 10.36.123.205 with SMTP id q196mr7279321itc.3.1483057713190; Thu, 29 Dec 2016 16:28:33 -0800 (PST)
X-Received by 10.157.35.89 with SMTP id k25mr1521322otd.11.1483057713163; Thu, 29 Dec 2016 16:28:33 -0800 (PST)
Path csiph.com!news.fcku.it!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!news.glorb.com!b123no4734409itb.0!news-out.google.com!g131ni7084itg.0!nntp.google.com!b123no4734400itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups it.comp.lang.visual-basic
Date Thu, 29 Dec 2016 16:28:32 -0800 (PST)
In-Reply-To <o43643$ha1$1@gioia.aioe.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=82.60.60.215; posting-account=eitZdgoAAAC6C9CXmyhLNaQM3MgI3eZM
NNTP-Posting-Host 82.60.60.215
References <o43643$ha1$1@gioia.aioe.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <9c017934-a1a0-41dc-9839-e5c4e213d0e3@googlegroups.com> (permalink)
Subject Re: aiuto su codice vbs
From Luca D <antaniserse@yahoo.it>
Injection-Date Fri, 30 Dec 2016 00:28:33 +0000
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Received-Body-CRC 1086219531
Lines 32
Xref csiph.com it.comp.lang.visual-basic:18944

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar


Thread

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