OT: new->file command line option

You know how in Windows you can right-click in the explorer to create a new blank file of types that are somehow magically registered in the deep, dark entrails of Windows?

Ex, new-> spreadsheet. It creates a blank template and you can now open this file in the proper application by simply calling it from a command line.

How do you create this initial blank file from a command line? Yes, I can keep copies of the various files and copy them as needed, but this breaks on other machines, different apps (I mean there are at least three spreadsheet applications I use under windows, Excel, Open Office and Gnumeric), and it doesn't track new versions.

I can see the association for the ftype, with command line options to open files.

opendocument.CalcDocument.1="C:\Program Files\OpenOffice.org 3\program \scalc.exe" -o "%1"

But new files just open the GUI with a new file, not create a file.

Reply to
a7yvm109gf5d1
Loading thread data ...

C:\>copy con newfile.xls

-Z-

Reply to
Michael

snipped-for-privacy@netzero.com Inscribed thus:

All it does is create an empty file with the correct extention. Its not a template. A template implies that you have a file pre-formatted with place holders for data.

Simply use the correct file extention.

You can give the file any name you want on the left hand side of the period.

--
Best Regards:
                     Baron.
Reply to
Baron

Try it. A 7 KB "emtpy file"? Why do all of you just assume and reply nonsense? It would have taken 30 seconds to try it yourself and not look like a total fool. Go ahead, TRY IT, DO IT, and *look*, fool. And it's different for every file type.

DUH.

You don't know what I'm trying to do, I need the stupid file to be ready to be used as a "data source". It will be registered and receive data through ODBC. Think an empty file will work? Doofus.

What a useless reply. Christ now I know the feeling Allison gets sometimes. Next time, don't reply if all you have is a bag full of NOTHING.

Reply to
a7yvm109gf5d1

If you really need a new file of a certain type, you need to use DDE to execute the command specified in the shell|new section of the registry key associated with the program. For Excel this is HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\New\ddeexec. You can find programs on the Internet which let you execute this command (ala ClassExec, DDE_run etc.) which is what Windows does after all.

That said, if you just say 'touch foo.xls' you get an empty file which Excel knows how to open (ie just typing 'foo.xls' on the command line opens it with Excel) and show the same UI as a properly blank file. Whether an empty file would work for you is an open question though.

--
Muzaffer Kal

DSPIA INC.
ASIC/FPGA Design Services

http://www.dspia.com
Reply to
Muzaffer Kal

Not sure I know the exact answer to your questions -- or rather, I'm sure there's an easier way to do it..., but here's one solution:

Write a short program in VB for DOS (Yes, I know, a very old program, but it should work fine?). Your VB program would create the XLS file instance and store it where you want it.

I suppose you could also use any modern version of Visual Basic too (or C+, etc...)? Just create the *.exe file and call that from whatever you are doing, even via Command Line.

Otherwise, as Muzaffer suggested, DDE might work if you can figure out how to get to it from the Command Line.

You can also try asking Mr. Excel (seriously). That's a podcast available through iTunes. They may have your answer there. Link:

formatting link

When you find your answer, could you please post here? One never knows when he'll need information like this....

Thanks.

-mpm

Reply to
mpm

create

the

not

with

I

this

Office

Contradicting yourself a bit here?

to

3\program

The file may be only in memory until you save it.

Reply to
JosephKK

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.