im tying to determine the last communication time of my McAfee clients and present it as property, so i wrote this property:
q:
if exist
"HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework" of registry then value
"LastUpdateCheck" of key
"HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework" of registry as string
else
"N/A" A: 20090226093319 I: singular string
i need help with formatting the answer from 20090226093319 to 26/02/2009 9:33:19 (or any other “readable” option).
q: (((last 2 of first 8 of it as integer as day_of_month) & (last 2 of first 6 of it as integer as month) & ( first 4 of it as integer as year)) & (((first 2 of it & “:”& first 2 of last 4 of it & “:” & last 2 of it) of (last 6 of it)) as local zoned time_of_day)) of "20090226093319"
A: Thu, 26 Feb 2009 09:33:19 -0800
Try this:
if exist “HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework” of registry then ((((last 2 of first 8 of it as integer as day_of_month) & (last 2 of first 6 of it as integer as month) & ( first 4 of it as integer as year)) & (((first 2 of it & “:”& first 2 of last 4 of it & “:” & last 2 of it) of (last 6 of it)) as local zoned time_of_day)) of (value “LastUpdateCheck” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework” of registry as string)) else “N/A”
at first attempt, it gave me “incompatible types” error, so i did the following:
q:
if exist
"HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework" of registry then ((((last 2 of first 8 of it) &
"/" & (last 2 of first 6 of it) &
"/" &( first 4 of it)) &
" " & (((first 2 of it &
":"& first 2 of last 4 of it &
":" & last 2 of it) of (last 6 of it)))) of (value
"LastUpdateCheck" of key
"HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework" of registry as string))
else
"N/A" A: 26/02/2009 12:04:00 I: singular string
can you explain the difference between our methods? is there an advantage to defining “day_of_month” and others?
Oops… The error was because the first part of the “if” clause returned a time and the “else” clause returned a string… you can cast the time to a string to solve this issue:
if exist “HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework” of registry then ((((last 2 of first 8 of it as integer as day_of_month) & (last 2 of first 6 of it as integer as month) & ( first 4 of it as integer as year)) & (((first 2 of it & “:”& first 2 of last 4 of it & “:” & last 2 of it) of (last 6 of it)) as local zoned time_of_day)) of (value “LastUpdateCheck” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework” of registry as string)) as string else “N/A”
But, you can do it your way too… the nice thing if were cast as a time, it make it easy to compare if you want to enhance this property at some later date…