lanux128

DateDiff

Jan 4th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; Inspired by: http://www.donationcoder.com/forum/index.php?topic=10149.msg78302#msg78302
  3. ; Last Updated:
  4.  
  5. #Persistent
  6. #SingleInstance, Force
  7. #NoEnv
  8. ;#NoTrayIcon
  9.  
  10. SetBatchLines, -1
  11. SetTitleMatchMode, 2        ; partial match
  12. SetWorkingDir, %A_ScriptDir%
  13. SendMode, Input
  14. DetectHiddenWindows, Off    ; they're hidden for a reason.
  15.  
  16. appname = DateDiff
  17. appicon = %appname%.ico
  18. ; Menu stuff
  19. If Not A_IsCompiled
  20.   IfExist, %A_ScriptDir%\%appicon%
  21.     Menu, Tray, Icon, %A_ScriptDir%\%appicon%
  22.  
  23. Gui, Add, MonthCal, vDayStart
  24. Gui, Add, Button, Default, Check
  25. Gui, Add, Text, xp+50 yp+5 w150 vDateDiffText, ;test ;blank at first
  26. Gui, Add, MonthCal, xs vDayEnd
  27. Gui, Show,, %appname%
  28. Return
  29.  
  30. ButtonCheck:
  31. Gui, Submit, NoHide
  32. ;FormatTime, DayPick, %DayStart%, MMMM d, yyyy
  33. ;Send, %DayStart%
  34. EnvSub, DayEnd, %DayStart%, days
  35. If DayEnd = 0
  36.   {
  37.   ;GuiControl, , DateDiffText, DateDiff: %DayEnd%
  38.   GuiControl, , DateDiffText, % "There is " . DayEnd . " difference."  
  39.   ;MsgBox % "There is " . DayEnd . " difference."
  40.   }
  41. Else If DayEnd <> 1
  42.   {
  43.   GuiControl, , DateDiffText, % DayEnd . " days."
  44.   ;MsgBox % DayEnd . " days."
  45.   }
  46. Else
  47.   {
  48.   GuiControl, , DateDiffText, % DayEnd . " day."
  49.   ;MsgBox % DayEnd . " day."
  50.   }
  51. Return
  52.  
  53. GuiClose:
  54. GuiEscape:
  55. ExitApp
  56. Return
Advertisement
Add Comment
Please, Sign In to add comment