Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - I 'm looking for a compiler ...

Reply
 
Old 08-13-2008   #1 (permalink)
threp


 
 

I 'm looking for a compiler ...

Hi,
1. I'm looking for the fastest way to open a CSV file that is full of
quotes, zap all the quotes, and then close it.
2. I 'm also looking for a compiler to make that script into an exe file .
The exe would need to grab a filename from the command line.

Any ideas ?

TIA

Threp




My System SpecsSystem Spec
Old 08-13-2008   #2 (permalink)
Al Dunbar


 
 

Re: I 'm looking for a compiler ...


"threp" <threp@xxxxxx> wrote in message
news:48a3573f$0$3218$426a74cc@xxxxxx
Quote:

> Hi,
> 1. I'm looking for the fastest way to open a CSV file that is full of
> quotes, zap all the quotes, and then close it.
A script is likely not going to give you the fastest method. I'd suggest
writing this in a compiled language instead.

Of course, this also depends on what you mean by "zapping" all the quotes.
Like, do you have a mosquito zapper that you think will do the job for you?

If "zap" simply means remove or delete, then you could write a script that:

- reads in the entire file (using .readall);
- changes all instances of a double quote character to a zero-length string;
- writes the file back out.

But are you sure the result would always be a valid csv file? If it
contained a line like this:

"test","comma next",",","done"

having four elements, stripping out the double quotes would give:

test,comma next,,,done

which clearly has five elements.
Quote:

> 2. I 'm also looking for a compiler to make that script into an exe file .
> The exe would need to grab a filename from the command line.
There have been attempts at creating a compiler for an existing scripting
language, but, imho, the result is not optimal, and often problematic. It
also depends on the language used. I'd suggest you go straight to a compiled
language from the start if blistering speed is your requirement.

/Al


My System SpecsSystem Spec
Old 08-13-2008   #3 (permalink)
Todd Vargo


 
 

Re: I 'm looking for a compiler ...

threp wrote:
Quote:

> Hi,
> 1. I'm looking for the fastest way to open a CSV file that is full of
> quotes, zap all the quotes, and then close it.
> 2. I 'm also looking for a compiler to make that script into an exe file .
> The exe would need to grab a filename from the command line.
>
> Any ideas ?
'NoQuotes.vbs
'Usage: cscript /nologo NoQuotes.vbs path_to\YourFile.cvs
Set objArgs = WScript.Arguments
If objArgs.Count = 0 Then Wscript.Quit
filename = objArgs(0)
Const ForReading = 1, ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile (filename, ForReading, True)
txt = f.ReadAll
Set f = fso.OpenTextFile (filename, ForWriting, True)
f.Write Replace(txt, Chr(34), "")
f.Close

Sorry, can not help with item 2.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

My System SpecsSystem Spec
Old 08-13-2008   #4 (permalink)
McKirahan


 
 

Re: I 'm looking for a compiler ...

"threp" <threp@xxxxxx> wrote in message
news:48a3573f$0$3218$426a74cc@xxxxxx
Quote:

> Hi,
> 1. I'm looking for the fastest way to open a CSV file that is full of
> quotes, zap all the quotes, and then close it.
I presume you want to save the file before the "close".

Option Explicit
Const cCSV = "noquotes.csv"
Dim intCSV : intCSV = 0
Dim strCSV
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
strCSV = objFSO.OpenTextFile(cCSV,1). ReadAll
intCSV = Len(strCSV)
strCSV = Replace(strCSV,Chr(34),"")
objFSO.OpenTextFile(cCSV,2,True).Write(strCSV)
Set objFSO = Nothing
WScript.Echo intCSV - Len(strCSV) & " quotes removed."
Quote:

> 2. I 'm also looking for a compiler to make that script into an exe file .
> The exe would need to grab a filename from the command line.
AutoIt.


My System SpecsSystem Spec
Old 08-14-2008   #5 (permalink)
mr_unreliable


 
 

Re: I 'm looking for a compiler ...

threp wrote:
Quote:

> 2. I 'm also looking for a compiler to make that script into an exe file .
> The exe would need to grab a filename from the command line.
>
hi Threp,

If you have vb (classic), then you could insert that code
and compile it to an exe. As for the newer vb (vb.net)
you could also use that, although it is a bit more
complicated.

As far as the other suggestions you will get here, (autoit,
vbs2exe, etc), those are not really "compilers", they are
more accurately characterized as "wrappers". What they do
is wrap (bundle) up your script with the runtimes into an
exe file. So, while it looks like an exe, it is really
only an exe startup module which will then just run your
script in the background.

For all practical purposes, this may be a distinction without
a difference. So if all you want is an exe, there are lots
of ways to get there.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)
My System SpecsSystem Spec
Old 08-14-2008   #6 (permalink)
James Whitlow


 
 

Re: I 'm looking for a compiler ...

"mr_unreliable" <kindlyReplyToNewsgroup@xxxxxx> wrote in message
news:%23AUY73i$IHA.3396@xxxxxx
Quote:

> threp wrote:
Quote:

>> 2. I 'm also looking for a compiler to make that script into an exe file
>> . The exe would need to grab a filename from the command line.
>>
> If you have vb (classic), then you could insert that code
> and compile it to an exe. As for the newer vb (vb.net)
> you could also use that, although it is a bit more
> complicated.
I discovered one of my favorite wrappers (DotNetWrapper.vbs) in a
message you posted a few years ago:

http://groups.google.com/group/micro...989e0ac0b80e3c


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Command line compiler .NET General
VB Commandline compiler references .NET General
C Compiler Software
Compiler Provider Options .NET General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46