I want to subtract the WindowEnd time & WindowStart time . My windows registry values.
Written as
((((last 4 of (“0000” & ((it / 60) as string & last 2 of (“00” & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as string))) - (((last 4 of (“0000” & ((it / 60) as string & last 2 of (“00” & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as string))))
I am getting error as " The operator “minus” is not defined" .
How about something like this (based on the above):
((((last 4 of ("0000" & ((it / 60) as string & last 2 of ("00" & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value "WindowEnd" of it as string) of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry) as string))) as integer - (((last 4 of ("0000" & ((it / 60) as string & last 2 of ("00" & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value "WindowStart" of it as string) of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry) as string))) as integer)
Or depending on your use case, here’s a simplified version:
(value "WindowEnd" of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry as integer) - (value "WindowStart" of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry as integer)
It suppose to give me result as 1 hour , 10 mins. But I am getting as 70 mins.
Q: ((((last 4 of (“0000” & ((it / 60) as string & last 2 of (“00” & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as string))) as integer - (((last 4 of (“0000” & ((it / 60) as string & last 2 of (“00” & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as string))) as integer)
A: 70
T: 384
Q:
=====
Q: (value “WindowEnd” of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maint
enance\Reboot” of native registry as integer) - (value “WindowStart” of key “HKE
Y_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry
as integer)
A: 70
T: 23332
Note :
As per Pic example : WindowEnd : 1030 ,
first 2 digit is hours and another 2 digit is mints.
I have tried to subtract in the below mechanism. However I am getting error.
Q: ((two digit hour of it) of current time_of_day)
A: 04
T: 310
Q:
if ((first 2 of (value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer <= (first 2 of (value “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer) then ((((two digit hour of it) of current time_of_day)) - (first 2 of (value “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer + ((first 2 of (value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer)) else ((first 2 of (value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer) - ((first 2 of (value “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer)
Q: if ((first 2 of (value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHIN
E\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer <
= (first 2 of (value “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\S
OFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer) the
n ((((two digit hour of it) of current time_of_day) as integer) - (first 2 of (v
alue “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\KaiserPe
rmanente\Maintenance\Reboot” of native registry) as integer + ((first 2 of (valu
e “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\KaiserPermane
nte\Maintenance\Reboot” of native registry) as integer)) else ((first 2 of (valu
e “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\KaiserPermane
nte\Maintenance\Reboot” of native registry) as integer) - ((first 2 of (value “W
indowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\KaiserPermanent
e\Maintenance\Reboot” of native registry) as integer)
A: 1
T: 724
Q:
Here my system time is 6:35am. Hence given 1 value is wrong one .
My code now as
if ((first 2 of (value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer <= (first 2 of (value “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer) then ((((two digit hour of it) of current time_of_day) as integer) - (first 2 of (value “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer + ((first 2 of (value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer)) else ((first 2 of (value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer) - ((first 2 of (value “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as integer)
Given your relevance that returned a value of “70”, I’ve integrated it as follows …
Q: (((it /60) as string & " hour " & (if ((it/60) > 1) then ("s") else ("")) & (if ((it mod 60) > 0) THEN ((it mod 60) as string & " minute" & (if ((it mod 60) > 1) then ("s") else (""))) ELSE (""))) of ((((last 4 of ("0000" & ((it / 60) as string & last 2 of ("00" & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value "WindowEnd" of it as string) of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry) as string))) as integer - (((last 4 of ("0000" & ((it / 60) as string & last 2 of ("00" & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value "WindowStart" of it as string) of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry) as string))) as integer))
A: 1 hour 10 minutes
T: 0.099 ms
Q:(((it /60) as string & " hour " & (if ((it/60) > 1) then (“s”) else (“”)) & (if ((it mod 60) > 0) THEN ((it mod 60) as string & " minute" & (if ((it mod 60) > 1) then (“s”) else (“”))) ELSE (“”))) of ((((last 4 of (“0000” & ((it / 60) as string & last 2 of (“00” & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value “WindowEnd” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as string))) as integer - (((last 4 of (“0000” & ((it / 60) as string & last 2 of (“00” & ((it mod 60) as string))) of (first 2 of it as integer * 60 + last 2 of it as integer) of it) of ((value “WindowStart” of it as string) of key “HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot” of native registry) as string))) as integer))
A: 1 hour 10 minutes
T: 1083
I don’t have those registry keys, so it’s harder to test your values, but try this …
Q: (((it /60) as string & " hour " & (if ((it/60) > 1) then ("s") else ("")) & (if ((it mod 60) > 0) THEN ((it mod 60) as string & " minute" & (if ((it mod 60) > 1) then ("s") else (""))) ELSE (""))) of ((((substring (0,2) of it) as Integer * 60 + ((substring (2,2) of it) as Integer)) of (value "WindowEnd" of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry)) as integer - (((substring (0,2) of it) as Integer * 60 + ((substring (2,2) of it) as Integer)) of (value "WindowStart" of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry)) as integer))
OK, I broke down and added the Registry keys. The reference to the keys has to be re-cast “AS STRING” for the Substring object to be available. Give these a try …
Q: (((it /60) as string & " hour " & (if ((it/60) > 1) then ("s") else ("")) & (if ((it mod 60) > 0) THEN ((it mod 60) as string & " minute" & (if ((it mod 60) > 1) then ("s") else (""))) ELSE (""))) of ((((substring (0,2) of it) as Integer * 60 + ((substring (2,2) of it) as Integer)) of (value "WindowEnd" of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry as string)) as integer - (((substring (0,2) of it) as Integer * 60 + ((substring (2,2) of it) as Integer)) of (value "WindowStart" of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry as string)) as integer))
A: 0 hour 30 minutes
T: 0.310 ms
or
Q: (((IF (it > 60) THEN ((it /60) as string & " hour " & (if ((it/60) > 1) then ("s") else (""))) ELSE ("")) & (if ((it mod 60) > 0) THEN ((it mod 60) as string & " minute" & (if ((it mod 60) > 1) then ("s") else (""))) ELSE (""))) of ((((substring (0,2) of it) as Integer * 60 + ((substring (2,2) of it) as Integer)) of (value "WindowEnd" of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry as string)) as integer - (((substring (0,2) of it) as Integer * 60 + ((substring (2,2) of it) as Integer)) of (value "WindowStart" of key "HKEY_LOCAL_MACHINE\SOFTWARE\CRQ\Maintenance\Reboot" of native registry as string)) as integer))
A: 30 minutes
T: 0.302 ms