Sign in to follow this  
Followers 0
pezo89

LockDate

7 posts in this topic

Hi,

i am making a little script for work.

but my question is how can i make the script not function after a spesific date`?

only way i can tell is to have it draw the biosdates into an ini file, and check them up against ea.

but as that requires the user to have the script running every day it is not the best option..

any ideas

it is plain and simple a Lock/delete section of the script to make it unusable after a spesific date/month

in advance,

Thanks for any responses.

Share this post


Link to post
Share on other sites



Two years here but you haven't found Macros and If..Then loops in the helpfile?


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

God point :)

thanks for the help thou. however i have one issue thou

when having the logical operator to check if value is higher, it also fails when it is the same, how can i bypass that?

$date = @YEAR 
$date2 = @MON  
if $date2 <= 03 Then    
MsgBox(0,"Error","DAte over limit")     
endif
Edited by pezo89

Share this post


Link to post
Share on other sites

Nvm figured it out :)

final product

$Enddate = 03 ;Put the enddate here
$date2 = @MON ;Check against current month

;if the current date is higher than the current date, stop the program
if $date2 <$Enddate Then
    MsgBox(0,"Error","DAte over limit")
    endif

Share this post


Link to post
Share on other sites

Also take a look at the Date Management section in the User Defined Functions Reference section of the help file. This code, after some modification, may be useful to you too.

;===============================================================================
; Function Name:   _Time_InRange()
; Description:  Determine if the current time is within a given Range
; Syntax:       _Time_InRange("Low time", "High time")
; Parameter(s): $sTime - Low end of the range (Start time)
;               $eTime - High end of the range (End time)
; Requirement(s):
; Return Value(s): 1 if current time is within the range otherwise 0
; Author(s):   George (GEOSoft) Gedye
; Modification(s): Replaced _NowTime(4) With Formatted @Hour & @Min
; Note(s):  This only uses Hours and Minutes
; Example(s):   MsgBox(0, "Time is good", _Time_InRange("08:00", "23:59"))
;===============================================================================

Func _Time_InRange($sTime, $eTime)
  Local $vRange = 0, $cTime
  $cTime = Number(@Hour & @Min)
  If $cTime >= Number(StringFormat("%04d",StringRegExpReplace($sTime, "\D", ""))) AND _
    $cTime <= Number(StringFormat("%04d",StringRegExpReplace($eTime, "\D", ""))) Then $vRange = 1
  Return $vRange
EndFunc   ;<==> _Time_InRange()

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Heh, now that looks a shitload more complicated than mine lol :)

il see if i can get it into my head while iv had some sleep lol..

for now my little "simple" version will do :)

Thanks alot thou :P

Share this post


Link to post
Share on other sites

Thanks alot thou :)

You bet. Good luck.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0