Тема: [AutoIt3, Source] LifeTimeVisual by Chemist
Так як мій блоґ тимчасово не працює, опублікую тут.
Короткий опис
Скрипт показує, грубо кажучи, скільки Вам жити сі лишило. Ідея прийшла після перегляду Блоґа одного кібера.
Вхідні дані (параметри командного рядка), це 3 параметра:
-BD - Рік Вашого народження;
-BM - Місяць Вашого народження;
-avgLifeTime - Середня тривалість життя для Вашого (регіону/статі/способу життя);
Приклад запуску:
LifeTimeVisual.exe -BD 1988 -BM 9 -avgLifeTime 65
▼code
; April 3, 2015
; Author Chemist, chemist.org.ua, license GNU GPL v3
; Version 1.02
#pragma compile(UPX, true)
#include <GUIConstantsEx.au3>
;Settings
$delimeterZero = ' '
$delimeterEnd = 'X'
$delimeterFree = '.'
;Start data
$startDateYear = 1988
$startDateMonth = 9
$avgLifeTime = 65
$cmdParamCount = Int($CmdLine[0]) ;to integer
if ($cmdParamCount > 0) Then
for $i=0 to $cmdParamCount-1
if $CmdLine[$i] = "-BD" Then ;Birth date
$startDateYear = Int($CmdLine[$i+1])
EndIf
if $CmdLine[$i] = "-BM" Then
$startDateMonth = Int($CmdLine[$i+1])
EndIf
if $CmdLine[$i] = "-avgLifeTime" Then
$avgLifeTime = int($CmdLine[$i+1]);
EndIf
Next
EndIf
;Initialization variables
$txt = "";
$EndedMonth = 0;
$FreeMonth = 0;
$delimeterX = $delimeterZero
$startDateYearBlock = int($startDateYear/5)*5
;entry
$txt &= "Birth date = " & $startDateYear & @CRLF
$txt &= "Birth month = " & $startDateMonth & @CRLF
$txt &= "Average life time = " & $avgLifeTime & @CRLF
$txt &= @CRLF
for $j = 1 to $avgLifeTime + 5
for $i = 1 to 12
if ($j*12+$i > ($avgLifeTime+($startDateYear - $startDateYearBlock )+1)*12+($startDateMonth-1)) Then ;??? Simplificate it, Chemist
$delimeterX = $delimeterZero
ElseIf ((($startDateYearBlock+$j)*12+$i) >= @Year*12+@mon) Then
$delimeterX = $delimeterFree
elseif (((($startDateYearBlock+$j)*12+$i)) >= ($startDateYear+1)*12+$startDateMonth) Then ;??? Simplificate it, Chemist
$delimeterX = $delimeterEnd
EndIf
$txt = $txt & $delimeterX
if $delimeterX = $delimeterEnd Then
$EndedMonth += 1;
elseif $delimeterX = $delimeterFree Then
$FreeMonth += 1;
EndIf
Next
$txt = $txt & ' ';
if mod($j, 5) = 0 Then
$year = String($startDateYearBlock+($j))
$txt = $txt & $year & @CRLF;
if (mod($j, 5*5) = 0) Then
$txt = $txt & @CRLF;
EndIf
EndIf
Next
$txt &= @CRLF
$txt &= "[" &$EndedMonth& "/" &$FreeMonth& "] of " &$EndedMonth+$FreeMonth & " " & @CRLF
consoleWrite($txt);
GUICreate("My GUI", 600, 400) ; will create a dialog box that when displayed is centered
$edit = GUICtrlCreateEdit($txt, 10, 10, 600-20, 400-20)
$sFont = "Lucida Console"
GUICtrlSetFont($edit, 9, 400, 0, $sFont)
GUISetState(@SW_SHOW) ; will display an empty dialog box with a combo control with focus on
; Loop until the user exits.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
▼Розрахунок для мене
Birth date = 1988
Birth month = 9
Average life time = 65
XXXX XXXXXXXXXXXX 1990
XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX 1995
XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX 2000
XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX 2005
XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX 2010
XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXX......... 2015
............ ............ ............ ............ ............ 2020
............ ............ ............ ............ ............ 2025
............ ............ ............ ............ ............ 2030
............ ............ ............ ............ ............ 2035
............ ............ ............ ............ ............ 2040
............ ............ ............ ............ ............ 2045
............ ............ ............ ............ ............ 2050
............ ............ ............ ........ 2055
[307/473] of 780
Post's attachments
LifeTimeVisual_1.02.zip 343.31 kb, 407 downloads since 2015-04-04