How to we know if how many times and how many users used our macro.. any help appreciated..
How to we know if how many times and how many users used our macro.. any help appreciated..
(OP)
Hello Everybody,
This is very nice platform to share and enhance our knowledge. Only because of this site I could speed up my work.
I came with a query that, when we create a macro, can we create some code such that we will get know that, how many times our macro has been used. I believe based on this we could calculate how many man hrs we saved... :) so that we could present our achievement to management.
Any help on this would really be appreciated..
I have just taken a portion of code from cklong (Automotive) (OP)'s post
Does anybody know how to modify this code to use as catia macro.. I'm really weak in programming
**************************
Dim path As String
Dim filename As String
Dim scrpt As String
Dim objFSO, objReadFile, contents
Dim ccontents As String
On Error Resume Next
path = "c:\temp\" 'location of file
filename = "test.txt" 'add text name
scrpt = "test" 'name of macro
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objReadFile = objFSO.OpenTextFile(path & filename, 1, False)
ccontents = objReadFile.ReadAll
If ccontents = "" Then
ccontents = 0
End If
ccontents = ccontents + 1
mut = Round(ccontents / 25)
If ccontents = 100 Then
MsgBox "You have use " & scrpt & " " & ccontents & "times you must really like this program."
ElseIf ccontents = 1 Then
MsgBox "Thank you for trying " & scrpt & " I hope you enjoy this program."
ElseIf ccontents = 25 * mut Then
MsgBox "You have use " & scrpt & " " & ccontents & "times. I think you owe me a coffee"
End If
Set Datos = CATIA.fileSystem.CreateFile(path & filename, True)
Set ostream = Datos.OpenAsTextStream("ForAppending")
ostream.Write ccontents & Chr(10)
ostream.Close
********************************
This is very nice platform to share and enhance our knowledge. Only because of this site I could speed up my work.
I came with a query that, when we create a macro, can we create some code such that we will get know that, how many times our macro has been used. I believe based on this we could calculate how many man hrs we saved... :) so that we could present our achievement to management.
Any help on this would really be appreciated..
I have just taken a portion of code from cklong (Automotive) (OP)'s post
Does anybody know how to modify this code to use as catia macro.. I'm really weak in programming

**************************
Dim path As String
Dim filename As String
Dim scrpt As String
Dim objFSO, objReadFile, contents
Dim ccontents As String
On Error Resume Next
path = "c:\temp\" 'location of file
filename = "test.txt" 'add text name
scrpt = "test" 'name of macro
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objReadFile = objFSO.OpenTextFile(path & filename, 1, False)
ccontents = objReadFile.ReadAll
If ccontents = "" Then
ccontents = 0
End If
ccontents = ccontents + 1
mut = Round(ccontents / 25)
If ccontents = 100 Then
MsgBox "You have use " & scrpt & " " & ccontents & "times you must really like this program."
ElseIf ccontents = 1 Then
MsgBox "Thank you for trying " & scrpt & " I hope you enjoy this program."
ElseIf ccontents = 25 * mut Then
MsgBox "You have use " & scrpt & " " & ccontents & "times. I think you owe me a coffee"
End If
Set Datos = CATIA.fileSystem.CreateFile(path & filename, True)
Set ostream = Datos.OpenAsTextStream("ForAppending")
ostream.Write ccontents & Chr(10)
ostream.Close
********************************





RE: How to we know if how many times and how many users used our macro.. any help appreciated..
You have to create a log file....its not difficult, search forum with keyword log file or timestamp, there are few examples.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: How to we know if how many times and how many users used our macro.. any help appreciated..
Can you please point out any example that could be useful for me?
Thanks you,
Rangrao Padiyar
RE: How to we know if how many times and how many users used our macro.. any help appreciated..
Is also written there how you can find user name, computer, domain, time....
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...