Creating a log file

Hi guys,

I need to create a button that will copy the full pathnames of the selected file and then paste that pathname into a predefined txt file, prefixing it with the current date & time.

i.e.

20091027 12:10:45 f:\folder\filename.abc

When I select another file and hit the new button this file should also be added to the next line of the same txt document.

Ideally I would like to automatically create a log whenever I launch a certain filetype from Directory Opus but I can't imagine this being possible!!!

Any help would be much appreciated.

Regards

Roly

For the command itself, simply create an MS-DOS batch mode button that runs the following command:

echo {date|yyyyMMdd} {time|HH:mm:ss} {filepath$} >> C:\Temp\FileLog.txt

This will append each filename to a file called C:\Temp\FileLog.txt (change this path as desired)

To have it happen automatically when you launch a filetype, you could edit the double-click setting for the FileType in question, to run this function first before launching the file.

Excellent, so far so good... I think.

I've edited the left double-click event in the file types editor with the following MS-DOS Batch Function :

echo {date|yyyyMMdd} {time|HH:mm:ss} {filepath$} >> C:\Temp\FileLogDWG.txt
"C:\Program Files\AutoCAD 2009\acad.exe" {f}

Can I hide or exit the command prompt after I run the DO command...? Currently I have to exit AutoCAD before the command prompt disappears, which I find quite irritating!!!

You can use the @runmode HIDE directive.

Regards, AB

Works a treat!!!

Thanks guys.

Further to the above, is it possible to add the same functionality when I right click on a file(s) and select "open" rather than double clicking...?

Currently, the only way to add to the log file is by double clicking a single file or pressing enter when multiple files are selected. I prefer to use the "open" option rather than hitting enter on multiple files.

Not without changing what "Open" does.

However, you could add another item to the context menu which does the same thing as your double-click action, and select that instead of Open.

Good shout, I'll do that instead. Cheers Leo.

Hi guys,

Nine years on and I need to revisit this post.

I haven't used this for several years now but I need to start using it again. Unfortunately it no longer seems to fully work. This is the code I am using for the latest version of AutoCAD.

@runmode HIDE
echo {date|yyyyMMdd} {time|HH:mm:ss} {filepath$} >> C:\Users\%username%\Documents\FileLogDWG.txt "C:\Program Files\Autodesk\AutoCAD 2018\acad.exe"  /P AutoCAD /Product "C3D" /Language "en-US"

When I run the command "C:\Program Files\Autodesk\AutoCAD 2018\acad.exe" /P AutoCAD /Product "C3D" /Language "en-US" from the Run prompt, AutoCAD opens as expected, so that's all good.

The first part of the command echo {date|yyyyMMdd} {time|HH:mm:ss} {filepath$} >> C:\Users\%username%\Documents\FileLogDWG.txt initially created and then appends to the log file so all is good there as well.

The issue I have is after double clicking on a DWG file, the file does not open, only the log file gets updated.

Any help will be much appreciated.

Regards

Blueroly

There should be a return in the command, which the new forum ate in the old post.

I've corrected the old post.

1 Like

That works, thanks Leo.

Am I right in saying that I can replace line 3 in the code below to FileType ACTION=open

I assume if this is ok, I won't have to update the path when I upgrade to a newer version?

@runmode HIDE
echo [{date|yyyyMMdd} {time|HH:mm:ss}] {filepath$} >> "C:\Users\%username%\OneDrive - WSP O365\01 Software\[Log Files]\FileLogDWG.txt"
"C:\Program Files\Common Files\Autodesk Shared\AcShellEx\AcLauncher.exe" /O {f}

Looks OK. Did you try it and find a problem?

No problem, it seems to work in the same manner as the original code.