Prev: SOLVED Script to Run System Backup in Vista
Next: OCR in browser using MODI in VBscript - Any thoughts appreciated
From: Pegasus [MVP] on 19 Feb 2010 03:42 "Al Dunbar" <alandrub(a)hotmail.com> said this in news item news:5E2070A1-88E9-4EA2-BBAD-F6A0270D4933(a)microsoft.com... > > The only potential issue I see with the approach has to do with > maintenance. If, for example, it was necessary to adapt this code to > rename "*.std_tempor" files as "*.std", one would need to remember to > change both instances of "8" to "10". I would tend to use len(sFileType) > instead of the constant in order to avoid that problem. > > Also, since the .getextensionname method is being used, I would tend to > create the resulting filename using the .buildpath method instead of > simple concatenation. I'm not saying that it is wrong to use > concatenation, just that switching between different ways of parsing > filenames is an additional level of complexity that can complicate > maintenance. > > /Al > Agreed, but let's not confuse a beginner with stuff that is likely to confuse him.
From: ekrengel on 19 Feb 2010 07:18 On Feb 19, 3:42 am, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > "Al Dunbar" <aland...(a)hotmail.com> said this in news itemnews:5E2070A1-88E9-4EA2-BBAD-F6A0270D4933(a)microsoft.com... > > > > > > > > > The only potential issue I see with the approach has to do with > > maintenance. If, for example, it was necessary to adapt this code to > > rename "*.std_tempor" files as "*.std", one would need to remember to > > change both instances of "8" to "10". I would tend to use len(sFileType) > > instead of the constant in order to avoid that problem. > > > Also, since the .getextensionname method is being used, I would tend to > > create the resulting filename using the .buildpath method instead of > > simple concatenation. I'm not saying that it is wrong to use > > concatenation, just that switching between different ways of parsing > > filenames is an additional level of complexity that can complicate > > maintenance. > > > /Al > > Agreed, but let's not confuse a beginner with stuff that is likely to > confuse him. I would have actually used the replace function along with len like Al suggested...and then just create another string for the new extension. But, there are several ways to get the right solution in vbscript and none of them are really wrong.
From: Al Dunbar on 19 Feb 2010 19:57 "Pegasus [MVP]" <news(a)microsoft.com> wrote in message news:OzahM#TsKHA.1796(a)TK2MSFTNGP02.phx.gbl... > > > "Al Dunbar" <alandrub(a)hotmail.com> said this in news item > news:5E2070A1-88E9-4EA2-BBAD-F6A0270D4933(a)microsoft.com... >> >> The only potential issue I see with the approach has to do with >> maintenance. If, for example, it was necessary to adapt this code to >> rename "*.std_tempor" files as "*.std", one would need to remember to >> change both instances of "8" to "10". I would tend to use len(sFileType) >> instead of the constant in order to avoid that problem. >> >> Also, since the .getextensionname method is being used, I would tend to >> create the resulting filename using the .buildpath method instead of >> simple concatenation. I'm not saying that it is wrong to use >> concatenation, just that switching between different ways of parsing >> filenames is an additional level of complexity that can complicate >> maintenance. >> >> /Al >> > > Agreed, but let's not confuse a beginner with stuff that is likely to > confuse him. Agreed. Confusing beginners with the simpler aspects is much better ;-) But that is why I did not show actual script, but just described the issues in a language close to English. /Al
From: Al Dunbar on 19 Feb 2010 20:02 "ekrengel" <erickrengel5(a)gmail.com> wrote in message news:5cf2af62-14fc-4252-a4ad-7f3ff5ccc3af(a)k19g2000yqc.googlegroups.com... > On Feb 19, 3:42 am, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: >> "Al Dunbar" <aland...(a)hotmail.com> said this in news >> itemnews:5E2070A1-88E9-4EA2-BBAD-F6A0270D4933(a)microsoft.com... >> >> >> >> >> >> >> >> > The only potential issue I see with the approach has to do with >> > maintenance. If, for example, it was necessary to adapt this code to >> > rename "*.std_tempor" files as "*.std", one would need to remember to >> > change both instances of "8" to "10". I would tend to use >> > len(sFileType) >> > instead of the constant in order to avoid that problem. >> >> > Also, since the .getextensionname method is being used, I would tend to >> > create the resulting filename using the .buildpath method instead of >> > simple concatenation. I'm not saying that it is wrong to use >> > concatenation, just that switching between different ways of parsing >> > filenames is an additional level of complexity that can complicate >> > maintenance. >> >> > /Al >> >> Agreed, but let's not confuse a beginner with stuff that is likely to >> confuse him. > > I would have actually used the replace function along with len like Al > suggested...and then just create another string for the new > extension. But, there are several ways to get the right solution in > vbscript and none of them are really wrong. Agreed. Any script that works correctly most of the time is as good as any other script that gives the same results. And if you had provided a solution in your style before Pegasus made his contribution, then we would be suggesting that he not confuse the beginner... ;-) /Al
From: Marc M on 21 Feb 2010 11:10 On Feb 19, 8:02 pm, "Al Dunbar" <aland...(a)hotmail.com> wrote: > "ekrengel" <erickreng...(a)gmail.com> wrote in message > > news:5cf2af62-14fc-4252-a4ad-7f3ff5ccc3af(a)k19g2000yqc.googlegroups.com... > > > > > > > On Feb 19, 3:42 am, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > >> "Al Dunbar" <aland...(a)hotmail.com> said this in news > >> itemnews:5E2070A1-88E9-4EA2-BBAD-F6A0270D4933(a)microsoft.com... > > >> > The only potential issue I see with the approach has to do with > >> > maintenance. If, for example, it was necessary to adapt this code to > >> > rename "*.std_tempor" files as "*.std", one would need to remember to > >> > change both instances of "8" to "10". I would tend to use > >> > len(sFileType) > >> > instead of the constant in order to avoid that problem. > > >> > Also, since the .getextensionname method is being used, I would tend to > >> > create the resulting filename using the .buildpath method instead of > >> > simple concatenation. I'm not saying that it is wrong to use > >> > concatenation, just that switching between different ways of parsing > >> > filenames is an additional level of complexity that can complicate > >> > maintenance. > > >> > /Al > > >> Agreed, but let's not confuse a beginner with stuff that is likely to > >> confuse him. > > > I would have actually used the replace function along with len like Al > > suggested...and then just create another string for the new > > extension. But, there are several ways to get the right solution in > > vbscript and none of them are really wrong. > > Agreed. Any script that works correctly most of the time is as good as any > other script that gives the same results. > > And if you had provided a solution in your style before Pegasus made his > contribution, then we would be suggesting that he not confuse the > beginner... ;-) > > /Al- Hide quoted text - > > - Show quoted text - Thanks again for the script and input, guys. I am now very interested in learning VB script inside/out. Do you guys have any online training URLs or resources that you can share? How did you all get so proficient in scripting w/ VB. Regards, Marc
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: SOLVED Script to Run System Backup in Vista Next: OCR in browser using MODI in VBscript - Any thoughts appreciated |