Script to log run and close apps into Mircosoft Office journal

H

Harpik

I'm looking for some kind of automated logging into Microsoft Outlook
Journal.
I wish that script was started from command line start timer and that
apps, than after minut later check what is oppened from main bar. And
on closing that apps stop the timer and save new item into Microsoft
Outlook Journal. I have found sth like that (at end), but it is not
compatibile to new version of autocad, neither it cannot work with all
apps, but only Autocad or others that have VBA. After few minutes
using autocad it hangs apps, dont know why. But logging and so on is
ok.

Thanks for any clue.

Harpik

--- code ##---

Option Explicit
Public WithEvents ACADApp As AcadApplication ' Use with Application
Event Examples
Public myolapp As Object
Public myitem As Object
Public SALARYMANOPEN As Boolean
Public DOCUMENTNAME As String
Public REGVAL As Variant
Public FN

Sub AcadStartup()
' This example intializes the public variable (ACADApp) which will
be used
' to intercept AcadApplication Events
'
' The VBA WithEvents statement makes it possible to intercept an
generic Object
' with the events associated with that object.
'
' Before you will be able to trigger any of the AcadApplication
events,
' you will first need to run this procedure.

' We could get the application from the ThisDocument object, but
that would
' require having a drawing open, so we grab it from the system.
Set ACADApp = GetObject(, "AutoCAD.Application")
FN = GetVariable("DWGNAME")
Call ACADApp_EndOpen(FN)
End Sub

Private Sub ACADApp_BeginQuit(Cancel As Boolean)
If DOCUMENTNAME = "" Then End
myitem.Subject = DOCUMENTNAME
myitem.StopTimer
myitem.Save
SALARYMANOPEN = False
End Sub

Private Sub ACADApp_EndOpen(ByVal FileName As String)
If SALARYMANOPEN = True Then
myitem.Subject = DOCUMENTNAME
myitem.StopTimer
myitem.Save
End If
Set myolapp = CreateObject("Outlook.Application")
Set myitem = myolapp.CreateItem(4)
myitem.Type = "AutoCAD"
myitem.StartTimer
SALARYMANOPEN = True
DOCUMENTNAME = FileName
End Sub

--- end code ### ----
 
M

Michael Bauer [MVP - Outlook]

In that sample I don't see why only Applications with VBA should be
supported.

You could have a list with all ProgIDs that you want to look for, like:
- "Excel.Application"
- "Word.Application.
- "Any.Application"
- etc.

In Visual Basic, e.g., you could write a standlone EXE with a timer. Once in
a minute call all your list items via GetObject. If it returns an error the
application runs else it doesn't.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?productid=300120654&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am 5 Feb 2007 00:42:51 -0800 schrieb Harpik:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Running Apps and Threads 1

Top