Jump to content
Developer Wiki and Function Reference Links ×

File log


Recommended Posts

I need a file log. Until someone will add this feature, I want to try to write my own file log.

I mean a text file relate to the WORK file, not in general, as VW is use to write since the mincad release.

But I have no idea how to start. The technical (I mean code) in not the problem at the moment. 

I have, first, to understand the problem, starting with a simple code:

I'm thinking to write two tool script LogIN and LogOut, but I never wrote a simple txt file until now (in VScript, I mean)...

Another step could be an automatic script, that run each time I open the file project...

I have also tried to set a worksheet... but it doesn't works.

So, as you can easily understand, I have few ideas but... confused" 😋

Thank you

 

L.

Edited by lucioing
Link to comment

Are you looking to do something like write the file name and a date/time stamp to a text file? I would recommend looking at python for this, as both file writing and time stamps are far superior to the options in VS. You can also find a lot of tutorials on writing a text file via python.

 

vs.GetFName() will get the name of the current file.

 

Triggering the log automatically requires the SDK, so is possible but a bit more complicated

  • Like 1
Link to comment

1. There is no such thing as a script that runs automatically when you open or close a file in VW.  It has been asked for for years.

 

2. Writing data to the worksheet idea might be the best option. Take a look at the script(s) in the follow thread for an idea of how to create and access a worksheet and how to write data into cells.

 

I think I would start with a small worksheet and just insert a line every time I opened the file. That way the most recent data is always at the top and you always write into the same cell(s) instead of having to figure out how much data you already have.

 

Another way to do this would be to make a symbol with a Record attached.  When you Open the file, insert symbol instance and write the start time. When you get ready to close, write the stop time. You can then use a worksheet to report on the time in the file. Only problem is if someone deletes the symbol instances.

Link to comment

Here we are!

Just wrote two 'tool', one for start timer, to stop it the second.

When you start a new drawing/project, click on 'start' button tool (yes, you have to create a palette or add them to an existing one) and star to work.

When you stop your job, click on stop button and 'mark' the timer. Of course, you can do it every time you are working to the file...

I know it is far to be perfect, but it is just a begin.

Hope you like it.

Thanks to Pat, I want to share my little job so, any comment is welcome!

 

thank you again, Pat and JBenghiat

 

L.

Schermata 2019-06-16 alle 23.34.00.jpg

MyFileLOG_Start.txt

MyFileLOG_Stop.txt

Edited by lucioing
  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...