Nbanonimous Posted April 20, 2008 Share Posted April 20, 2008 hey guys basically i thought of this Day You Were Born: Jan 1 Sunday 1 Feb 4 Monday 2 March 4 Tuesday 4 April 0 Wednesday 5 May 2 Thursday 7 June 5 Friday 8 July 0 Saturday (No Decimal) August 3 September 6 October 1 November 4 December 6 Examples January 4th, 1995 Step 1 - 95 Step 2 95 x 5 = 475 Step 3 475/4 = 118.75 Step 4 118.75 118 (If there is a decimal, erase it so there is only an integer remaining) Step 5 Add Month Code 118 + 1 = 119 + 4 (the Day) = 123 Step 6 Divide by 7 123/7 = 17.[u]5[/u]7142 (First Number to the right of the decimal is the day) I want it to ask you for the Date you were born like February 25, 1993. And then it'll run through all those steps and tell you the day you were born... I have no clue how to do that though cuz iono how to do step 5 lolol thats tuff btw feb 25, 1993 is a thursday Best Free Undetectable Proxies!www.CPUMod.netwww.CellFoneTrader.comwww.TindoraFarms.com Link to comment Share on other sites More sharing options...
d4rk Posted April 20, 2008 Share Posted April 20, 2008 step 5, can you show the problem ? [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
JustinReno Posted April 20, 2008 Share Posted April 20, 2008 I have made a program that shows this if you search the forums for keywords like Birthday (Or Age) Calculator. Link to comment Share on other sites More sharing options...
ErickSegura Posted April 20, 2008 Share Posted April 20, 2008 CODE$daysofweek = StringSplit("Sun,Mon,,Tue,Wed,,Thu,Fri", ",") $Year=95 $Month=01 $Day=04 $result=$Year*5 ConsoleWrite($result & @CRLF) $result=Int($result/4) ConsoleWrite($result & @CRLF) $result=($result+$Month+$Day)/7 ConsoleWrite($result & @CRLF) $point=StringInStr($result,".",2)+1 $result=StringMid($result,$point,1) $result=$daysofweek[$result] ConsoleWrite($result & @CRLF) MsgBox(0+64+4096,"You Born...","... in day " & $result) Look this code... you need to define me the saturday Link to comment Share on other sites More sharing options...
therks Posted April 20, 2008 Share Posted April 20, 2008 #include <UnixTime.au3> Global $weekdays[7] = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ] $ts = _TimeMakeStamp(0, 0, 0, 2, 11, 1982) ; _TimeMakeStamp( [ second [, minute [, hour [, day [, month [, year [, isDST ]]]]]]] ) MsgBox(0, '', 'This date is a: ' & $weekdays[_StringFormatTime('%w', $ts)])UnixTime.au3 My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Nbanonimous Posted April 20, 2008 Author Share Posted April 20, 2008 sry guys that was a typo i meant step 6 because i dont know how autoit can take the first number to the right of the decimal and then match it with the day of the week code... Best Free Undetectable Proxies!www.CPUMod.netwww.CellFoneTrader.comwww.TindoraFarms.com Link to comment Share on other sites More sharing options...
weaponx Posted April 20, 2008 Share Posted April 20, 2008 Straight out of the help file... #include <Date.au3> ; Week day number for a given date $iWeekday = _DateToDayOfWeek (@YEAR, @MON, @MDAY) ; Should be equal to @Wday MsgBox(4096, "", "Todays WeekdayNumber is: " & $iWeekDay) MsgBox(4096, "", "Today is a : " & _DateDayOfWeek($iWeekDay))oÝ÷ Ù«¢+Ø¥¹±Õ±ÐíѹÔÌÐì((ìIÑÉ¥ÙÑ¡±½¹¹µ(ÀÌØíÍ1½¹å9µô}Ñå=]¬ ]d¤((ìIÑÉ¥ÙÑ¡É٥ѹµ(ÀÌØíÍM¡½ÉÑå9µô}Ñå=]¬ ]d°Ä¤()5Í ½à ÐÀäØ°ÅÕ½Ðíä½]¬ÅÕ½Ðì°ÅÕ½ÐíQ½ä¥ÌèÅÕ½ÐìµÀìÀÌØíÍ1½¹å9µµÀìÅÕ½Ðì ÅÕ½ÐìµÀìÀÌØíÍM¡½ÉÑå9µµÀìÅÕ½Ðì¤ÅÕ½Ðì¤ Link to comment Share on other sites More sharing options...
Valuater Posted April 20, 2008 Share Posted April 20, 2008 expandcollapse popup#include <GuiConstants.au3> #Include <GuiEdit.au3> #include <date.au3> opt("GUIOnEventMode", 1) Demo() ;------------------------------------------------------------------------------------------------------ ;- C O N S O L E D E M O ;------------------------------------------------------------------------------------------------------ Func Demo() Global $ConsoleID=0 $ConsoleID = ConsoleWinCreate(-1, -1, 638, 326, "Age Demo...", "Starting demo..." & @CRLF, True) $answer1 = ConsoleWinInput($ConsoleID, "Please input your Year of Birth (example.. 1985) ?", 15, 1 ) $Vanswer1 =ConsoleWinVerify($ConsoleID, $answer1, "Please input your Year of Birth (example.. 1985) ?", True, 4, 4) ConsoleWinWrite($ConsoleID, "OK.. " & @CRLF, 30, 1) $answer2 = ConsoleWinInput($ConsoleID, "Please input your Month of Birth (example.. 3 = March) ?", 45, 1 ) $Vanswer2 =ConsoleWinVerify($ConsoleID, $answer2, "Please input your Month of Birth (example.. 3 = March) ?", True, 1, 2) ConsoleWinWrite($ConsoleID, "Good.. " & @CRLF, 60, 1) $answer3 = ConsoleWinInput($ConsoleID, "Please input your Day of Birth (ex.. 22) ?" , 75, 1 ) $Vanswer3 =ConsoleWinVerify($ConsoleID, $answer3, "Please input your Month of Birth (example.. 22) ?", True, 1, 2) ConsoleWinWrite($ConsoleID, "Great!.. Please wait while i calculate your age..." & @CRLF, 90, 1) Sleep(1000) ConsoleWinWrite($ConsoleID, " You have been alive " & _DateDiff( 'd',$Vanswer1 &"/"& $Vanswer2 &"/"& $Vanswer3,_NowCalc()) & " days!" & @CRLF, 100, 1) Sleep(5000) ConsoleWinWrite($ConsoleID, "Example: Clearing console in five seconds...Thanks Valuater 8) ") Sleep(5000) ConsoleWinClear($ConsoleID) ConsoleWinWrite($ConsoleID, "Demo finished! Exiting in five seconds...") Sleep(5000) Exit EndFunc ;------------------------------------------------------------------------------------------------------ ;- C O N S O L E L I B R A R Y ;------------------------------------------------------------------------------------------------------ ;=============================================================================== ; Description: Create a Window console to display status text information with history ; Parameter(s): $x - x position of the window ; $y - y position of the window ; $width - Optional - Window width ; $height - Optional - Window height ; $Title - Optional - Console Window title ; $text - Optional - Initial text to display. ; $CreateProgress - Optional - Create Progress (True/False) ; $BgColor - Optional - background color ; $FgColor - Optional - Foreground color ; $Transparency - Optional - Transparency (0=Invisible, 255=Visible) ; Requirement(s): None ; Return Value(s): The Console ID ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Note(s): None ;=============================================================================== Func ConsoleWinCreate($x, $y, $width=638, $height=126, $Title="Console", $Text="", $CreateProgress=False, $BgColor=0xFFFFFF, $FgColor=0xFF0000, $Transparency=255) Dim $Console[3] $Console[0] = GuiCreate($Title, $width, $height, $x, $y, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW) GUISetOnEvent($GUI_EVENT_CLOSE, "ConsoleWinExitEvent") If $CreateProgress Then $height -= 20 $Console[1] = GuiCtrlCreateEdit($Text & @CRLF, 0, 0, $width-1, $height-1, BitOR($ES_MULTILINE, $ES_READONLY, $ES_AUTOVSCROLL,$WS_HSCROLL,$WS_VSCROLL)) GUICtrlSetBkColor($Console[1], $BgColor) GUICtrlSetColor($Console[1], $FgColor) GUICtrlSetResizing($Console[1], $GUI_DOCKBORDERS) GUICtrlSetFont($Console[1], 12, 400, 0, "Courrier New") $Console[2] =0 If $CreateProgress Then $Console[2] = GUICtrlCreateProgress(0, $height+5, $width-1, 12) WinSetTrans($Console[0], "", $Transparency) GuiSetState() Return $Console EndFunc Func ConsoleWinExitEvent() GUIDelete(@GUI_WinHandle) Exit EndFunc ;=============================================================================== ; Description: Write a message to the console ; Parameter(s): $ConsoleID - Console ID returned by ConsoleWinCreate ; $text - Text to display. ; $Progress - Optional - Progress value (0-100) ; $NoCRLF - Optional - Don't add CRLF and the end of text ; $Replace - Optional - Replace last line ; Requirement(s): ConsoleWinCreate called first ; Return Value(s): None ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Note(s): None ;=============================================================================== Func ConsoleWinWrite($ConsoleID, $Text, $Progress=-1, $Speak=False, $NoCRLF=False, $Replace=False) If $Replace Then $string = GUICtrlRead($ConsoleID[1]) $pos = StringInStr($string, @CRLF, 0, -1) If $pos > 0 Then $pos += 1 $end = StringLen($string) _GUICtrlEdit_SetSel($ConsoleID[1], $pos, $end) Else $pos = StringLen(GUICtrlRead($ConsoleID[1])) _GUICtrlEdit_SetSel($ConsoleID[1], $pos, $pos) EndIf If $NoCRLF = False Then $Text = $Text & @CRLF GUICtrlSetData ($ConsoleID[1], $Text, 1) If $Speak Then ConsoleSpeak($Text) If $ConsoleID[2] >0 And $Progress>=0 Then GUICtrlSetData($ConsoleID[2], $Progress) EndFunc ;=============================================================================== ; Description: Ask for the user to input something ; Parameter(s): $ConsoleID - Console ID returned by ConsoleWinCreate ; $text - Text to display, the question. ; $Progress - Optional - Progress value (0-100) ; Requirement(s): ConsoleWinCreate called first ; Return Value(s): What user have typed. ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Note(s): $text could be an empty string ;=============================================================================== Func ConsoleWinInput($ConsoleID, $Text, $Progress=-1, $Speak = 0) WinSetOnTop($ConsoleID[0], "", 1) WinActivate($ConsoleID[0]) $string = GUICtrlRead($ConsoleID[1]) $pos = StringLen($string) _GUICtrlEdit_SetSel($ConsoleID[1], $pos, $pos) GUICtrlSetData ($ConsoleID[1], $Text, 1) GUICtrlSetStyle($ConsoleID[1], BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_HSCROLL, $WS_VSCROLL, $ES_WANTRETURN)) If $Speak Then ConsoleSpeak($Text) If $Text <> "" Then ; Wait for the user to input something While 1 Sleep(100) $String=GUICtrlRead($ConsoleID[1]) If StringRight($string, 2) = @CRLF Then ExitLoop ; Ensure that everything is typed at the end of edit control $pos = StringLen($String) _GUICtrlEdit_SetSel($ConsoleID[1], $pos, $pos) WEnd $pos = StringInStr($string, $Text, 0, -1) If $pos >0 Then $pos += StringLen($Text) Else $str = $string ; Wait for the user to input something While 1 Sleep(100) $String=GUICtrlRead($ConsoleID[1]) If StringRight($string, 2) = @CRLF And $string <> $str Then ExitLoop ; Ensure that everything is typed at the end of edit control $pos = StringLen($String) _GUICtrlEdit_SetSel($ConsoleID[1], $pos, $pos) WEnd $pos = StringInStr(StringLeft($string, StringLen($string)-2), @CRLF, 0, -1) If $pos > 0 Then $pos += 1 EndIf $string = StringMid($string, $pos) $string = StringLeft($string, StringLen($string)-2) GUICtrlSetStyle($ConsoleID[1], BitOR($ES_MULTILINE, $ES_READONLY, $ES_AUTOVSCROLL,$WS_HSCROLL,$WS_VSCROLL)) If $ConsoleID[2] >0 And $Progress>=0 Then GUICtrlSetData($ConsoleID[2], $Progress) Return $string WinSetOnTop($ConsoleID[0], "", 0) EndFunc ;=============================================================================== ; Description: Clear the console ; Parameter(s): $ConsoleID - The console ID ; Requirement(s): None ; Return Value(s): None ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Note(s): None ;=============================================================================== Func ConsoleWinClear($ConsoleID) GUICtrlSetData ($ConsoleID[1], "") If $ConsoleID[2] >0 Then GUICtrlSetData($ConsoleID[2], 0) EndFunc ;=============================================================================== ; Description: Save the content of the console to a file ; Parameter(s): $ConsoleID - The console ID ; $FileName - The filename used to save ; Requirement(s): None ; Return Value(s): Write status, same as FileWrite ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Note(s): None ;=============================================================================== Func ConsoleWinSave($ConsoleID, $FileName) $string = GUICtrlRead($ConsoleID[1]) Return FileWrite($FileName, $string) EndFunc ;=============================================================================== ; Description: Ask for the user to verify input something ; Parameter(s): $ConsoleID - Console ID returned by ConsoleWinCreate ; $VAns - info to verify ; $Text - Text to display, the question. ; $VNum - Optional - to verify an Intreger ; $VMin - Optional - Minimum length of string ; $VMax - Otional - Maximum length of string ; Requirement(s): ConsoleWinCreate available and ConsoleWinInput called first ; Return Value(s): What user has typed. ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Co - Author Valuater ; Note(s): $Text may not be an empty string ;=============================================================================== Func ConsoleWinVerify($ConsoleID, $VAns, $Text, $VNum = False, $VMin = 1, $VMax = 1000) While 1 ConsoleWinWrite($ConsoleID, "You have answered: " & $VAns) $VLen = StringLen($VAns) If $VNum And Int($VAns) > 0 And $VLen >= $VMin And $VLen <= $VMax Then If ConsoleWinInput($ConsoleID, 'Is this Correct? "Y" or "N" ') = "y" Then Return $VAns ElseIf Not $VNum And $VLen >= $VMin And $VLen <= $VMax Then If ConsoleWinInput($ConsoleID, 'Is this Correct? "Y" or "N" ') = "y" Then Return $VAns EndIf $VAns = ConsoleWinInput($ConsoleID, $Text) Sleep(10) WEnd EndFunc Func ConsoleSpeak($S_text) Local $oi_speech = ObjCreate("SAPI.SpVoice") If IsObj($oi_speech) Then $oi_speech.Speak ($S_text); use speech if wanted $oi_speech = "" EndFunc 8) Link to comment Share on other sites More sharing options...
GEOSoft Posted April 20, 2008 Share Posted April 20, 2008 Here's one that will do it alll for you. expandcollapse popupOpt ("GuiCoordMode", 2) #Include <date.au3> $mData = "" For $I = 1 To 12 $mData &= "|" & StringFormat("%02u", $I) Next $Gw = 500 $Gh = 200 $Comb_Style = BitOr(0x00200000, 0x0003) GUICreate("What day was I born?", $Gw, $Gh) GUICtrlCreateLabel("Enter the year..", 10,10, 80, 20) $Yr = GUICtrlCreateInput("", 0,-1, 35) GUICtrlCreateLabel("Select the Month", 20, -1, 90) $mth = GUICtrlCreateCombo("", 0,-1, 60, -1, $Comb_Style) GUICtrlSetState(-1, 144) GUICtrlCreateLabel("Select the Day", 20, -1, 90) $day = GUICtrlCreateCombo("", 0,-1, 40, -1, $Comb_Style) GUICtrlSetState(-1, 144) GUICtrlSetData($Mth, $mData) GUISetCoord(20, 50) $Lbl_Data = GUICtrlCreateLabel("", -1, -1, $Gw - 40, 90) $Btn_Clr = GUICtrlCreateButton("Reset", - ($Gw/2), 20, 60, 30) GUISetState() While 1 If StringLen(GUICtrlRead($Yr)) < 4 Then Do Sleep(2) If GUIGetMsg() = -3 Then Exit Until StringLen(GUICtrlRead($Yr)) = 4 GUICtrlSetState($mth, 336) EndIf Switch GUIGetMsg() Case - 3 Exit Case $mth $dData = "" For $I = 1 To _DateDaysInMonth(GUICtrlRead($Yr), GUICtrlRead($mth)) $dData &= "|" & StringFormat("%02u", $I) Next GUICtrlSetData($day, $dData) GUICtrlSetState($day, 336) Case $day Local $dY = GUICtrlRead($Yr), $dM = GUICtrlRead($mth), $dD = GUICtrlRead($day), $oData = @CRLF & "You were born " $astData = _Date_GetAstroSign($dM, $dD) $oData &= _DateDayofWeek(_DateToDayOfWeek ($dY, $dM, $dD)) & ", " & _DateMonthOfYear($dM, 0) & " " & $dD & ", " & $dY; & @CRLF If _DateIsLeapYear($dY) Then $oData &= " (Leap Year)" $oData &= @CRLF & @CRLF & "Your astrological sign is " & $astData[0] & @CRLF & "Your element is " & $astData[1] GUICtrlSetData($Lbl_Data, $oData) GUICtrlSetState($Btn_Clr, 256) Case $Btn_Clr GUICtrlSetState($mth, 144) GUICtrlSetState($day, 144) GUICtrlSetState($Yr, 256) GUICtrlSetData($Yr, "") GUICtrlSetData($day,"") GUICtrlSetData($Mth, $mData, "") GUICtrlSetData($Lbl_Data, "") EndSwitch Wend Func _Date_GetAstroSign($iMth, $iDay);;Return Astrological Data local $aData[2][13] = [ ["","Capricorn", "Aquarius", "Pisces", "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius"] _ , ["","Earth", "Air", "Water", "Fire", "Earth", "Air", "Water", "Fire", "Earth", "Air", "Water", "Fire"]] $rSign = $iMth Switch $iMth Case 1, 3; Capricorn If $iDay > 19 Then $rSign += 1 Case 2; Aquarius If $iDay > 17 Then $rSign += 1 Case 4, 5, 11; Aries If $iDay > 20 Then $rSign += 1 Case 6;Gemini If $iDay > 22 Then $rSign += 1 Case 12; Sagittarius If $iDay > 21 Then $rSign = 1 Case Else If $iDay > 21 Then $rSign += 1 EndSwitch local $Sg = $aData[0][$rSign], $El = $aData[1][$rSign], $Rtn[2] = [$Sg, $El] Return $Rtn EndFunc ;<==> _Date_GetAstroSign($iMth, $iDay) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Nbanonimous Posted April 21, 2008 Author Share Posted April 21, 2008 god damn how do you know all this stuff Best Free Undetectable Proxies!www.CPUMod.netwww.CellFoneTrader.comwww.TindoraFarms.com Link to comment Share on other sites More sharing options...
martin Posted April 21, 2008 Share Posted April 21, 2008 (edited) ;------------------------------------------------------------------------------------------------------ ;- C O N S O L E D E M O ;------------------------------------------------------------------------------------------------------I like your console demo Valuater, but not so keen that when you input you can delete back too far, so I added a bit to stop that. You might not like the way I did it but I think it works. expandcollapse popup#include <GuiConstants.au3> #include <GuiEdit.au3> #include <date.au3> Opt("GUIOnEventMode", 1) Demo() ;------------------------------------------------------------------------------------------------------ ;- C O N S O L E D E M O ;------------------------------------------------------------------------------------------------------ Func Demo() Global $ConsoleID = 0, $endstop = 0 $ConsoleID = ConsoleWinCreate(-1, -1, 638, 326, "Age Demo...", "Starting demo..." & @CRLF, True) GUIRegisterMsg($WM_COMMAND, "StopOverDelete") $answer1 = ConsoleWinInput($ConsoleID, "Please input your Year of Birth (example.. 1985) ?", 15, 1) $Vanswer1 = ConsoleWinVerify($ConsoleID, $answer1, "Please input your Year of Birth (example.. 1985) ?", True, 4, 4) ConsoleWinWrite($ConsoleID, "OK.. " & @CRLF, 30, 1) $answer2 = ConsoleWinInput($ConsoleID, "Please input your Month of Birth (example.. 3 = March) ?", 45, 1) $Vanswer2 = ConsoleWinVerify($ConsoleID, $answer2, "Please input your Month of Birth (example.. 3 = March) ?", True, 1, 2) ConsoleWinWrite($ConsoleID, "Good.. " & @CRLF, 60, 1) $answer3 = ConsoleWinInput($ConsoleID, "Please input your Day of Birth (ex.. 22) ?", 75, 1) $Vanswer3 = ConsoleWinVerify($ConsoleID, $answer3, "Please input your Month of Birth (example.. 22) ?", True, 1, 2) ConsoleWinWrite($ConsoleID, "Great!.. Please wait while i calculate your age..." & @CRLF, 90, 1) Sleep(1000) ConsoleWinWrite($ConsoleID, " You have been alive " & _DateDiff('d', $Vanswer1 & "/" & $Vanswer2 & "/" & $Vanswer3, _NowCalc()) & " days!" & @CRLF, 100, 1) Sleep(5000) ConsoleWinWrite($ConsoleID, "Example: Clearing console in five seconds...Thanks Valuater 8) ") Sleep(5000) ConsoleWinClear($ConsoleID) ConsoleWinWrite($ConsoleID, "Demo finished! Exiting in five seconds...") Sleep(5000) Exit EndFunc ;==>Demo ;------------------------------------------------------------------------------------------------------ ;- C O N S O L E L I B R A R Y ;------------------------------------------------------------------------------------------------------ ;=============================================================================== ; Description: Create a Window console to display status text information with history ; Parameter(s): $x - x position of the window ; $y - y position of the window ; $width - Optional - Window width ; $height - Optional - Window height ; $Title - Optional - Console Window title ; $text - Optional - Initial text to display. ; $CreateProgress - Optional - Create Progress (True/False) ; $BgColor - Optional - background color ; $FgColor - Optional - Foreground color ; $Transparency - Optional - Transparency (0=Invisible, 255=Visible) ; Requirement(s): None ; Return Value(s): The Console ID ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Note(s): None ;=============================================================================== Func ConsoleWinCreate($x, $y, $width = 638, $height = 126, $Title = "Console", $Text = "", $CreateProgress = False, $BgColor = 0xFFFFFF, $FgColor = 0xFF0000, $Transparency = 255) Dim $Console[3] $Console[0] = GUICreate($Title, $width, $height, $x, $y, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW) GUISetOnEvent($GUI_EVENT_CLOSE, "ConsoleWinExitEvent") If $CreateProgress Then $height -= 20 $Console[1] = GUICtrlCreateEdit($Text & @CRLF, 0, 0, $width - 1, $height - 1, BitOR($ES_MULTILINE, $ES_READONLY, $ES_AUTOVSCROLL, $WS_HSCROLL, $WS_VSCROLL)) GUICtrlSetBkColor($Console[1], $BgColor) GUICtrlSetColor($Console[1], $FgColor) GUICtrlSetResizing($Console[1], $GUI_DOCKBORDERS) GUICtrlSetFont($Console[1], 12, 400, 0, "Courrier New") $Console[2] = 0 If $CreateProgress Then $Console[2] = GUICtrlCreateProgress(0, $height + 5, $width - 1, 12) WinSetTrans($Console[0], "", $Transparency) GUISetState() Return $Console EndFunc ;==>ConsoleWinCreate Func ConsoleWinExitEvent() GUIDelete(@GUI_WinHandle) Exit EndFunc ;==>ConsoleWinExitEvent ;=============================================================================== ; Description: Write a message to the console ; Parameter(s): $ConsoleID - Console ID returned by ConsoleWinCreate ; $text - Text to display. ; $Progress - Optional - Progress value (0-100) ; $NoCRLF - Optional - Don't add CRLF and the end of text ; $Replace - Optional - Replace last line ; Requirement(s): ConsoleWinCreate called first ; Return Value(s): None ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Note(s): None ;=============================================================================== Func ConsoleWinWrite($ConsoleID, $Text, $Progress = -1, $Speak = False, $NoCRLF = False, $Replace = False) If $Replace Then $string = GUICtrlRead($ConsoleID[1]) $pos = StringInStr($string, @CRLF, 0, -1) If $pos > 0 Then $pos += 1 $end = StringLen($string) _GUICtrlEdit_SetSel($ConsoleID[1], $pos, $end) Else $pos = StringLen(GUICtrlRead($ConsoleID[1])) _GUICtrlEdit_SetSel($ConsoleID[1], $pos, $pos) EndIf $endstop = GUICtrlRead($ConsoleID[1]) If $NoCRLF = False Then $Text = $Text & @CRLF GUICtrlSetData($ConsoleID[1], $Text, 1) If $Speak Then ConsoleSpeak($Text) If $ConsoleID[2] > 0 And $Progress >= 0 Then GUICtrlSetData($ConsoleID[2], $Progress) EndFunc ;==>ConsoleWinWrite ;=============================================================================== ; Description: Ask for the user to input something ; Parameter(s): $ConsoleID - Console ID returned by ConsoleWinCreate ; $text - Text to display, the question. ; $Progress - Optional - Progress value (0-100) ; Requirement(s): ConsoleWinCreate called first ; Return Value(s): What user have typed. ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Note(s): $text could be an empty string ;=============================================================================== Func ConsoleWinInput($ConsoleID, $Text, $Progress = -1, $Speak = 0) WinSetOnTop($ConsoleID[0], "", 1) WinActivate($ConsoleID[0]) $string = GUICtrlRead($ConsoleID[1]) $pos = StringLen($string) _GUICtrlEdit_SetSel($ConsoleID[1], $pos, $pos) GUICtrlSetData($ConsoleID[1], $Text, 1) $endstop = GUICtrlRead($ConsoleID[1]) GUICtrlSetStyle($ConsoleID[1], BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_HSCROLL, $WS_VSCROLL, $ES_WANTRETURN)) If $Speak Then ConsoleSpeak($Text) If $Text <> "" Then ; Wait for the user to input something While 1 Sleep(100) $string = GUICtrlRead($ConsoleID[1]) If StringRight($string, 2) = @CRLF Then ExitLoop ; Ensure that everything is typed at the end of edit control $pos = StringLen($string) _GUICtrlEdit_SetSel($ConsoleID[1], $pos, $pos) WEnd $pos = StringInStr($string, $Text, 0, -1) If $pos > 0 Then $pos += StringLen($Text) Else $str = $string ; Wait for the user to input something While 1 Sleep(100) $string = GUICtrlRead($ConsoleID[1]) If StringRight($string, 2) = @CRLF And $string <> $str Then ExitLoop ; Ensure that everything is typed at the end of edit control $pos = StringLen($string) _GUICtrlEdit_SetSel($ConsoleID[1], $pos, $pos) WEnd $pos = StringInStr(StringLeft($string, StringLen($string) - 2), @CRLF, 0, -1) If $pos > 0 Then $pos += 1 EndIf $string = StringMid($string, $pos) $string = StringLeft($string, StringLen($string) - 2) GUICtrlSetStyle($ConsoleID[1], BitOR($ES_MULTILINE, $ES_READONLY, $ES_AUTOVSCROLL, $WS_HSCROLL, $WS_VSCROLL)) If $ConsoleID[2] > 0 And $Progress >= 0 Then GUICtrlSetData($ConsoleID[2], $Progress) Return $string WinSetOnTop($ConsoleID[0], "", 0) EndFunc ;==>ConsoleWinInput ;=============================================================================== ; Description: Clear the console ; Parameter(s): $ConsoleID - The console ID ; Requirement(s): None ; Return Value(s): None ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Note(s): None ;=============================================================================== Func ConsoleWinClear($ConsoleID) GUICtrlSetData($ConsoleID[1], "") $endstop = '' If $ConsoleID[2] > 0 Then GUICtrlSetData($ConsoleID[2], 0) EndFunc ;==>ConsoleWinClear ;=============================================================================== ; Description: Save the content of the console to a file ; Parameter(s): $ConsoleID - The console ID ; $FileName - The filename used to save ; Requirement(s): None ; Return Value(s): Write status, same as FileWrite ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Note(s): None ;=============================================================================== Func ConsoleWinSave($ConsoleID, $FileName) $string = GUICtrlRead($ConsoleID[1]) Return FileWrite($FileName, $string) EndFunc ;==>ConsoleWinSave ;=============================================================================== ; Description: Ask for the user to verify input something ; Parameter(s): $ConsoleID - Console ID returned by ConsoleWinCreate ; $VAns - info to verify ; $Text - Text to display, the question. ; $VNum - Optional - to verify an Intreger ; $VMin - Optional - Minimum length of string ; $VMax - Otional - Maximum length of string ; Requirement(s): ConsoleWinCreate available and ConsoleWinInput called first ; Return Value(s): What user has typed. ; Author(s): Jerome DERN (jdern "at" free "dot" fr) ; Co - Author Valuater ; Note(s): $Text may not be an empty string ;=============================================================================== Func ConsoleWinVerify($ConsoleID, $VAns, $Text, $VNum = False, $VMin = 1, $VMax = 1000) While 1 ConsoleWinWrite($ConsoleID, "You have answered: " & $VAns) $VLen = StringLen($VAns) If $VNum And Int($VAns) > 0 And $VLen >= $VMin And $VLen <= $VMax Then If ConsoleWinInput($ConsoleID, 'Is this Correct? "Y" or "N" ') = "y" Then Return $VAns ElseIf Not $VNum And $VLen >= $VMin And $VLen <= $VMax Then If ConsoleWinInput($ConsoleID, 'Is this Correct? "Y" or "N" ') = "y" Then Return $VAns EndIf $VAns = ConsoleWinInput($ConsoleID, $Text) Sleep(10) WEnd EndFunc ;==>ConsoleWinVerify Func ConsoleSpeak($S_text) Local $oi_speech = ObjCreate("SAPI.SpVoice") If IsObj($oi_speech) Then $oi_speech.Speak($S_text); use speech if wanted $oi_speech = "" EndFunc ;==>ConsoleSpeak Func StopOverDelete($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $hWndEdit If Not IsHWnd($ConsoleID[1]) Then $hWndEdit = GUICtrlGetHandle($ConsoleID[1]) $hWndFrom = $ilParam $iIDFrom = _WinAPI_LoWord($iwParam) $iCode = _WinAPI_HiWord($iwParam) Switch $hWndFrom Case $ConsoleID[1], $hWndEdit Switch $iCode Case $EN_CHANGE $Text = GUICtrlRead($ConsoleID[1]) If StringLen($Text) < StringLen($endstop) Then GUICtrlSetData($ConsoleID[1], $endstop) EndIf ; no return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>StopOverDelete Edited April 21, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
GEOSoft Posted April 21, 2008 Share Posted April 21, 2008 god damn how do you know all this stuffThe functionality for most is already in AutoIt, minly in date.au3. The only function I had to write was the one to get the astrological sign and that was fairly easy to do by looking everything up via Google. I now have the formula for calculating biorhythms so that will be next along with a re-design of the GUI. Note that I have been informed this script does not run on older versions of AutoIt but I'm not sure why yet. I'll look at that sometime in the future. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now