PDA

View Full Version : system time


cyfer
12-18-2006, 02:50 AM
is there a way to get the windows time " clock " through maxscript ?

i was thinking of making a script for an analouge watch , not depending on length or manual
keys in the scene ...

i did the whole thing pretty easy with just wiring , but i realized that any modification in the
scene time or scale will ruin the whole thing

thanks

ypuech
12-18-2006, 07:48 AM
Hi,

You can call timeStamp() returning the number of milliseconds since 00:00 hours that day :

millisecs = timeStamp()

MerlinEl
12-19-2006, 11:06 AM
Mabe this can help you:

1)teake windows time:

LocalTime

2)make some function:

fn theTime part =
(
local arr = filterString LocalTime "./ :"
case part of -- in other countries is diferent numbers (try you self)
(
#year :arr[3]
#month :arr[2]
#day :arr[1]
#hour :arr[4]
ect......
)
)

3)and use a "max timer" for refresh every second or minute:

Bobo
12-19-2006, 01:33 PM
WARNING!
The Local Time string is country-specific!

In the US, the MONTH is the FIRST element of the date, followed by the DAY and then YEAR, so your code would be wrong as it assumes the day as the first element!

From what I could test so far, the getFileCreateDate() method does not appear to be affected by the Regional Settings, but it might vary between Windows Versions - I would love some feedback from different countries to verify that as I could not find a definitive answer on Microsoft's support pages.

What do you get when you evaluate the code

getFileCreateDate (GetDir #maxroot + "\\3dsmax.exe")


On my machine running WinXP Pro 32bit, I am getting "9/29/2006 1:30:23 PM" regardless of Regional Settings. If you see something else, please post here as I am working on some code that depends on this!

MerlinEl
12-19-2006, 02:00 PM
Results in Czech Republic:

code: getFileCreateDate (GetDir #maxroot + "\\3dsmax.exe")
will return : "12/4/2006 9:31:02 AM"

code: filterString LocalTime "./ :"
will return : #("12", "19", "2006", "2", "59", "24", "PM")


god day to you :)

cyfer
12-20-2006, 12:57 AM
thanks guys
you are always great , always give help to others , " yupech , MerlinEl , BOBO " i thank you for your help

as for BOBO

i get this

getFileCreateDate (GetDir #maxroot + "\\3dsmax.exe")

"4/18/2006 5:16:28 PM"

localtime

"12/20/2006 2:55:06 AM"

my country setting is egypt +2 GMT

and my time is right on my PC !




-irrelevant subject " for BOBO , did the treematograph stop for good ? "

Bobo
12-20-2006, 02:19 AM
-irrelevant subject " for BOBO , did the treematograph stop for good ? "

Yes, I stopped working on it as soon as Marsel started working on his Schematic Material Editor. Then he stopped because it looked impossible to get a working product without serious code fixes from Autodesk. Now we both wait for the Max programmers to make those internal changes and get their version of the editor out someday (which we hope to have inspired ;)

You must admit TMG wasn't really useful, more of a gimmick and a reminder that we need something like that...

CGTalk Moderation
12-20-2006, 02:19 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.