OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 21-07-2008, 10:47
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default Odd Request... Timers in .cdr files?

Hey everyone,
I know this is probably an odd request... however I'm curious if it's possible!

Is there a small bit of script that will time how long a .cdr file is open? I'd like the script to start running at open, and just before closing either write the time in the .cdr file, or a text file on the computer. Is this possible?

We are making a "test" of sorts for all the designers in the company, and we need a indication of time it took to complete an example file... so my idea is to have it time from open to close, and save the result either within the corel file, or in an external text file!

I'm pretty sure I can accomplish the saving the information part of it myself and embedding the VBA project in my corel file... but the "timer" function of things... I don't have the slightest idea about...

Can anyone offer any insight? Much appreciated in advance!

Thanks,
B
Reply With Quote
  #2  
Old 21-07-2008, 19:20
Michael Cervantes
Guest
 
Posts: n/a
Default Vakcer Project Tracker

Here is what you need.

http://www.vakcer.com/
Reply With Quote
  #3  
Old 22-07-2008, 06:45
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default

hi michael! thanks for the info... i actually did stumble across this and found it to be quite interesting! However, this is a little more complex then what I need! I just need a timer for one file, and to be embedded in the .cdr file.

We have 23 designers spread out over north amercia, and I don't want to try and install software on all their computers to time them on one file! hahaha so something embedded in the file they are going to work on once, seems easier I think!

I don't even know if it's possible... but thats why I've come here to ask the experts!

Thanks,
B
Reply With Quote
  #4  
Old 22-07-2008, 08:08
Dave Rowland
Guest
 
Posts: n/a
Default

Well I had a similar problem but there is no timers as such...

So I needed to find a way of recording when a User was actually moving something within Corel Draw between our designers.

Without posting my code, I describe what it does, it uses a mixture of routines from SelectionChange/NewDocument/OpenDocument/SaveDocument. When a user selects something from Corel it notifies the SelectionChange event, this then records what time this happened with GetTickCount() (google it), when the user moves something again it takes the difference between the two GetTIckCount routines. IF the user is idle for 1 minute it considers that time as non-chargable time, when the user 'saves' the document it stores this to a central database with an Insert SQL Stored Procedure. I have got this running on all our office PC's and can produce statistics on each file. It works quite well as it has been running for about 7 months without too much hassle. Delay Load option is set correctly as VBA needs to be active at Corel Startup.

That Project recorder is interesting, bit late now to be looking at it lol.

I hooked into
Private Sub GlobalMacroStorage_SelectionChange() which is inside Corel Objects / ThisDocument
Reply With Quote
  #5  
Old 22-07-2008, 08:57
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default

wow... see... sometimes it's the simplest things that work! I never even thought of just a simple "time stamp" of sorts. Just a record of when they opened the file, then closed it!

I don't have to worry about anything other then open and close! It's a test... so they will know they are being timed... the quicker they complete it the better! they only have one chance to work on it... so if they close it... they are done! so it's in their best interest to get it done quicker!

so a simple time stamp at the beginning and end would suffice! I can do the math to calulate the time myself!

Thanks for the info!

B
Reply With Quote
  #6  
Old 23-07-2008, 01:17
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Document Timer

You could also write a start and stop time to the registry with the Timer function. You would want it a little smart I guess, so every document you opened didn't keep writing over the timer. So here is what I came up with. First you need to start the timer, this would go in your OpenDocument Event like this:
Code:
Private Sub GlobalMacroStorage_DocumentOpen(ByVal Doc As Document, ByVal FileName As String)
    If GetSetting("MyTimer", "Timer", "CloseTimer") = "" Then
        SaveSetting "MyTimer", "Timer", "OpenTimer", Timer
    End If
End Sub
Notice that I have it check the CloseTimer first. If the close Timer is empty then it writes the open time to the registry. If it finds data in the Close Timer it does not do anything. Next we need to set the close time like so:
Code:
Private Sub GlobalMacroStorage_DocumentClose(ByVal Doc As Document)
    If GetSetting("MyTimer", "Timer", "CloseTimer") = "" Then
        SaveSetting "MyTimer", "Timer", "CloseTimer", Timer
    End If
End Sub
Again we have it check itself to see if there is already data, if so it doesn't do anything. Now we have the time the document was opened and closed. So write another sub to return the time. Like so:
Code:
Sub CalcTimer()
    MsgBox "The document was open: " & Round(GetSetting("MyTimer", "Timer", "CloseTimer") - GetSetting("MyTimer", "Timer", "OpenTimer"), 2) & " seconds"
End Sub
So as you can tell this only works ones, so you need a sub also to clear the data, so you can run the timer again. That might look like:
Code:
Sub ClearTimers()
    SaveSetting "MyTimer", "Timer", "OpenTimer", ""
    SaveSetting "MyTimer", "Timer", "CloseTimer", ""
End Sub
Couple of things to what for, remember starting a NEW document does not start the timer, only Opening a document. Also this is very simple, if you want a much more robust solution I also suggest the Project Tracker software, it can do amazing things.

Hope that helps and if you have question, please ask!

-Shelby
Reply With Quote
  #7  
Old 23-07-2008, 06:48
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default

wow... i'm definately going to give this a try! thanks for the info! I'll let you know what happens!

B
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Odd square characters Beatniks CorelDRAW/Corel DESIGNER VBA 4 23-04-2007 23:38
Viewer for .CDR files Alex FAQ 2 27-12-2006 16:06
Show default icon for CDR files in Windows Explorer Alex FAQ 0 27-04-2005 12:10
CW 4.1 features request Denis Korotkov Calendar Wizard 3 13-09-2004 08:44
help me, even or odd, dominiqueL CorelDRAW/Corel DESIGNER VBA 2 18-10-2003 01:19


All times are GMT -5. The time now is 19:10.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com