Jump to content


Click the link below to see the new game I'm developing!


Photo
- - - - -

2 Issues with Time


13 replies to this topic

#1 Kelvin Rapley

Kelvin Rapley

    Member

  • Members
  • PipPip
  • 40 posts
  • Gender:Male
  • Location:BIRMINGHAM, ENGLAND

Posted 11 January 2007 - 08:23 AM

For a Staff Clocking System I would like to display the current time.

Issue 1: Is there a way of displaying @time on my clocking screen and updating it every second without it momentarily removing focus away from the input field for the swipe card?

Issue 2: I've experimented with displaying the client pc time (ie the actual clock that fires up when you double click the time display) alongside the ProIV clocking screen and using the client pc time for the clocking time. I can get the time into a file on the samba drive by using the command
#VAR = SYSTEM-CRT("GUI Echo. |TIME > S:\dostime")
the only drawback is a quick flash of the black screen. I've tried calling a batch file with @Echo Off but the black screen still flashes. Is there a way of issuing a DOS command with the window minimized?

Any Ideas?
Kelvin

#2 Paul Blew

Paul Blew

    Member

  • Members
  • PipPip
  • 24 posts
  • Gender:Male
  • Location:Bristol, United Kingdom

Posted 11 January 2007 - 08:37 AM

Kelvin,

If you're in the GUI world, how about writing an ActiveX control to show the clock? It could either display the client clock using Windows APIs or possibly show the server's clock by firing an event every second which could be answered by a PRO-IV logic which sets the time shown by the control according to the current value of @TIME.

Hope this helps.

Paul

#3 Kelvin Rapley

Kelvin Rapley

    Member

  • Members
  • PipPip
  • 40 posts
  • Gender:Male
  • Location:BIRMINGHAM, ENGLAND

Posted 11 January 2007 - 10:28 AM

Thanks for your suggestion Paul. I don't suppose anyone knows of an existing AxtiveX Control I could get hold of?

If it is not possible to avoid showing the window when issuing a DOS command does anyone know a different method of getting the client pc time? Displaying the client pc time is a quick and simple solution but because I can't guarantee the Unix server and the client pc will always be in synch I need to use the same time that is on display.

Kelvin

#4 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 420 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 11 January 2007 - 11:29 AM

What about a simple ActiveX Timer Control updating time every minute? Its saves you the problem of have the DOS prompt screen flashing when you do a system call, and you can use the server time

Used this for a proof of concept, if you need it let me know...

#5 Kelvin Rapley

Kelvin Rapley

    Member

  • Members
  • PipPip
  • 40 posts
  • Gender:Male
  • Location:BIRMINGHAM, ENGLAND

Posted 11 January 2007 - 12:02 PM

What about a simple ActiveX Timer Control updating time every minute? Its saves you the problem of have the DOS prompt screen flashing when you do a system call, and you can use the server time

Used this for a proof of concept, if you need it let me know...


Neil,

That sounds ideal - updating the time display every minute is perfectly adequate for this system - so I'd be pleased to receive the ActiveX TImer Control.

Thanks,
Kelvin.

#6 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 420 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 11 January 2007 - 12:05 PM

Kelvin if you can give me an hour or two, a bit busy at the moment. I'll see if I can dig up some code for you as well

#7 Kelvin Rapley

Kelvin Rapley

    Member

  • Members
  • PipPip
  • 40 posts
  • Gender:Male
  • Location:BIRMINGHAM, ENGLAND

Posted 11 January 2007 - 12:31 PM

Cheers Neil.

#8 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 420 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 11 January 2007 - 02:24 PM

Here goes. Attached is a zip file called S309Timer.zip. Inside it is an ocx file of the same name. As far as I know its freeware and it does not require a wrapper to be written.

Extract it to a suitable place, run the ActiveX Gallerry so that it searches for it.

Properties that you need to set:

Enabled = 1
Interval = Number expressed in milliseconds I think

Only has 1 Event that gets executed when the specified interval is reached

Shout if you need anything else

Attached Files



#9 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,652 posts
  • Gender:Male
  • Location:Spain

Posted 11 January 2007 - 02:45 PM

As for point 2, you can use this to get around the black DOS screen getting popped up...

Rather than a Batch file write a VB Script, and call it C:\time.vbs

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\time.txt")

objFile.WriteLine date() & " " & time()

objFile.Close

And then call it from ProIV with this...

$$CMD = "rundll32 url.dll,FileProtocolHandler c:\time.vbs"
#VAR = SYSTEM-CRT('GUI WINDOWS ' + $$CMD)

HTHs,

Rob D

#10 Kelvin Rapley

Kelvin Rapley

    Member

  • Members
  • PipPip
  • 40 posts
  • Gender:Male
  • Location:BIRMINGHAM, ENGLAND

Posted 11 January 2007 - 03:23 PM

Here goes. Attached is a zip file called S309Timer.zip. Inside it is an ocx file of the same name. As far as I know its freeware and it does not require a wrapper to be written.

Extract it to a suitable place, run the ActiveX Gallerry so that it searches for it.

Properties that you need to set:

Enabled = 1
Interval = Number expressed in milliseconds I think

Only has 1 Event that gets executed when the specified interval is reached

Shout if you need anything else


Neil,

Thanks for the ActiveX Control and the instructions.

I've extracted it and run the ActiveX Gallery but the search did not find the new control.
I noticed that the warning screen before the search says: "This option scans your PC registry for OCX controls and therefore may take some time to run."
Do I have to add the new control to the registry for the ActiveX Gallery to pick it up?

#11 Kelvin Rapley

Kelvin Rapley

    Member

  • Members
  • PipPip
  • 40 posts
  • Gender:Male
  • Location:BIRMINGHAM, ENGLAND

Posted 11 January 2007 - 03:29 PM

As for point 2, you can use this to get around the black DOS screen getting popped up...

Rather than a Batch file write a VB Script, and call it C:\time.vbs

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\time.txt")

objFile.WriteLine date() & " " & time()

objFile.Close

And then call it from ProIV with this...

$$CMD = "rundll32 url.dll,FileProtocolHandler c:\time.vbs"
#VAR = SYSTEM-CRT('GUI WINDOWS ' + $$CMD)

HTHs,

Rob D


Thanks Rob,

This gives me another option.

Kelvin

#12 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 420 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 12 January 2007 - 04:48 AM

Sorry Kelvin, I forgot you need to register the control

Transfer the desktop version of the S309Timer.ocx to the c:\Windows\system32 directory

Register the control on the desktop by doing:

Start - Run - regsvr32 c:\Windows\system32\S309Timer.ocx

You should get "DllRegisterServer in c:\Windows\system32\S309Timer.ocx Succeeded."

#13 Kelvin Rapley

Kelvin Rapley

    Member

  • Members
  • PipPip
  • 40 posts
  • Gender:Male
  • Location:BIRMINGHAM, ENGLAND

Posted 12 January 2007 - 10:38 AM

Neil,

That did the trick.

I've written a prototype just displaying @time as a usmg every second and it doesn't appear to interfere with the card swipe.

So it should give me the solution I need. ;)

Thanks again for all your assistance.

Kelvin

#14 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 420 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 12 January 2007 - 10:41 AM

No problem, glad you came right without having to spend days researching various options like I did



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Click the link below to see the new game I'm developing!