| View previous topic :: View next topic |
| Author |
Message |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Tue Dec 03, 2002 4:42 pm Post subject: DATETIME + OPTION FIELDSEP problem |
|
|
Hi Im having a problem with a function thats translates a timer from VDSMEDIA.DLL to regular Minutes:Seconds.
Ive put the OPTION FIELDSEP,"." and when it gets to this part:
| Code: | rem Current position and Total lenght
%%SecsInDay = @PROD(@PROD(24,60),60)
%%Duration = @DATETIME(nn:ss,@FDIV(@FORMAT(@media(duration,mMedia),.0),%%SecsInDay))
%%Position = @DATETIME(nn:ss,@FDIV(@FORMAT(@media(position,mMedia),.0),%%SecsInDay))
dialog set,timepos1,%%Position/%%Duration |
I get the following error "Exception: Invalid date\time at line..." (the line where the %%duration variable is) on a Windows system that has a "," as the
default separator in the regional settings.
It doesnt give the error on most on my Windows system, where the parameter is a "." in the regional settings.
Thanks in advance for your help  |
|
| Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 766 Location: Eastman, GA
|
Posted: Tue Dec 03, 2002 5:02 pm Post subject: |
|
|
Try this...Sometimes the way you have setup will still return 9.5 or (number).5
| Code: |
rem Current position and Total lenght
%%SecsInDay = @PROD(@PROD(24,60),60)
%%Duration = @DATETIME(nn:ss,@FORMAT(@FDIV(@media(duration,mMedia),%%SecsInDay),.0))
%%Position = @DATETIME(nn:ss,@FORMAT(@FDIV(@media(position,mMedia),%%SecsInDay),.0))
dialog set,timepos1,%%Position/%%Duration
|
Let me know if this works
NodNarb |
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Tue Dec 03, 2002 5:22 pm Post subject: |
|
|
Sorry it doesnt work, it stays always with zeros (00:00/00:00)
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Dec 03, 2002 10:41 pm Post subject: |
|
|
I'm not real sure about this one but have you tried putting .0 in quotes? _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Dec 03, 2002 11:16 pm Post subject: |
|
|
Have ya checked that @media(duration,mMedia)
and @media(position,mMedia) both return exactly
the same format on the problem systems?
If so - what format are they in?
BTW, you can change the DECIMALSEP back and forth
if you can determine when each one is needed...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Dec 03, 2002 11:34 pm Post subject: |
|
|
I was thinking along those lines also, but didn't think the returned number would be the problem. Now that I think about it though, if the DLL is returning a number with a "," then it won't calculate right. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Wed Dec 04, 2002 1:59 am Post subject: |
|
|
Ok, I will change it, so I can get the returned numbers.
I will get back to you with that....
Thanks |
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Wed Dec 04, 2002 5:28 pm Post subject: |
|
|
Ok, after doing some tests with Tommy, Skit and Protected (Thanks guys) it seems the problem is with NON-ENGLISH systems only. And my DLL will but updated so its has its own option DECIMALSEP (Thanks Tommy for the hint). I didnt find a workaround in VDS. So to make it easier for everyone using that DLL, an update will be done ASAP.
Thanks guys. |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Dec 04, 2002 5:43 pm Post subject: |
|
|
Is there a reason ya can't check the time format
returned and adjust it to decimal "."? I'm assuming
@media(duration,mMedia) etc. returns a float or
ya wouldn't be having this problem...
| Code: |
%t = @media(duration,mMedia)
%x = 1
REPEAT
if @equal(@substr(%t, %x), ",")
%t = @strdel(%t, %x)
%t = @strins(%t, %x, ".")
end
%x = @succ(%x)
UNTIL @greater(%x, @len(%t))
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Dec 04, 2002 5:47 pm Post subject: |
|
|
OOPS.. forgot a line, so if ya already checked the
code example, check it again.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Wed Dec 04, 2002 6:48 pm Post subject: |
|
|
Mac,
It works like a charm now with your code sample... Thank you so much
The VDS demo that comes with VDSMEDIA will be updated as well as the DLL with new functionnalities.
Last edited by marty on Wed Dec 04, 2002 6:56 pm; edited 1 time in total |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Dec 04, 2002 6:52 pm Post subject: |
|
|
No problem Marty.  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Wed Dec 04, 2002 9:18 pm Post subject: |
|
|
Although you can work around the problem, the DLL should still return a decimal no matter what if you can do that.
No offense Marty but the users shouldn't have to work around anything.
If you can, how about sharing the Option DecimalSep-type DLL code at the Developer Forum.
Good luck  _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Dec 04, 2002 9:35 pm Post subject: |
|
|
Ya prolly do basically the same thing in the DLL as the
workaround Sheep, check for a comma and replace it...
BTW Marty, here's another (prolly faster) way to do that
in VDS, and doesn't use an extra var unless a comma is
found:
| Code: |
%t = @media(duration,mMedia)
if @greater(@pos(",", %t), 0)
%p = @pos(",", %t)
%t = @strdel(%t, %p)
%t = @strins(%t, %p, ".")
%p = ""
end
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Thu Dec 05, 2002 1:39 am Post subject: |
|
|
Although this is more related to Delphi than VDS, I'll post it here for clarity. All
that's needed to accomplish the same thing in Delphi is setting the special DecimalSeparator
variable to an appropriate character. I'll see about posting this on the developer forum
too. |
|
| Back to top |
|
 |
|