Jump to content

Simple task just my brain is going to break..


Go to solution Solved by BrewManNH,

Recommended Posts

Posted

Hey all,

After hours of coding i came on a part where i really need to think about it..

It has to go about registration

Let's say my registration date is : 2013-10-06

Year - Month - Day

Now i want make a registration checker like

$day = InputBox("Day", "Day:", "")
$month = InputBox("Month", "Month:", "")
$year = InputBox("Year", "Year:", "")

then ,

If the $year is the same or higher AND $year < @year then do

then check the date 

but here is my problem my brain is failed hard right now so i need your help , if we are in the same year as 2013 then check the month , if he registratedin 2012 but we are in 2013 not needed to check day and month ofc because it dont care if its lower or higher

What i have now:

$day = InputBox("Day", "Day:", "")
$month = InputBox("Month", "Month:", "")
$year = InputBox("Year", "Year:", "")
If $year >= $regyear And $year <= @YEAR Then

EndIf 

Thanks in advance :)

 

 

Posted

What are you wanting for the final outcome? If a date is before or after another date, or if the entered date is longer than some preset limit compared to the registered date? Such as, if the registered date is more than 12 months before the present date?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

Well , then i can see the date difference

If i fill in 2012 then its date difference 1 , but when i fill in 2014 its also 1 so not good imo ?

Posted

$regyear = StringTrimRight($trimreg,6)
$leftregmonth = StringTrimLeft($trimreg,5)
$regmonth = StringTrimRight($leftregmonth,3)
$regday = stringtrimleft($trimreg, 8)
;;;
;~ $day = InputBox("Day", "Day:", "")
;~ $month = InputBox("Month", "Month:", "")
;~ $year = InputBox("Year", "Year:", "")
If $year >= $regyear And $year <= @YEAR Then
    If $year = $regyear Then
        If $month >= @MON Then
            If $day 
EndIf

this is what i have , 

What i exactly want if the date is under the current date but above the registration date then give the information

else

ERROR

  • Solution
Posted

Here's one way of doing it that just converts the year month and day into a string and does a quick comparison.
 

$regdate = "20123112" ; December 31, 2012
$todaysDate = @YEAR & @MON & @MDAY
$inputYear = InputBox("Enter year as yyyy", "")
$inputMonth = InputBox("Enter month as mm", "")
$inputDay = InputBox("Enter day as dd", "")
$enteredDate = $inputYear & $inputMonth & $inputDay
If $regdate > $enteredDate And $enteredDate < $todaysDate Then
    MsgBox("", "Earlier", "The entered date is earlier than the registered date")
ElseIf $regdate = $enteredDate And $enteredDate < $todaysDate Then
    MsgBox("", "Same", "The entered dates are the same")
Else
    MsgBox("", "After", "The entered date is after than the registered date")
EndIf

This doesn't do ANY error or entry checking, and it only tests that the date entered is less than today, and compares it to the registered date.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

as i said ,

Lets say regyear = 2013

regmonth = 10

regday = 24

and with something we can play with , i got headage about thinking about this..

I just want , if the date what is entered using inputbox is higher then the regyear,month and day AND lower then current time then msgbox(0, "" , "Well Done"

Else

msgbox(0, "", "Error")

EDIT:

Let me test this wait

Edited by Jack023

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...