JohnOne Posted July 18, 2011 Posted July 18, 2011 Where did you see the error message? Because as far as I know your script must be compiled. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Valuater Posted July 18, 2011 Author Posted July 18, 2011 (edited) I guess that after reading the thread i have it in my mind the you MUST include " #include<XProTec.au3> ; MUST BE AN INCLUDE" at the top. As im using XProTecFree i assumed i must there as-well. Please someone correct me if im mistaking but the way iv understood it is as follows, 1.) The #include<XProTec.au3> ; MUST BE AN INCLUDE $D_Mail = "developer@msn.com " ; your email $D_Program = "XPro-Tec-Free" ; your program name $U_Price = "20.00" ; the amount of money you wish to be payed by the user $U_Trial = "30" ; amount of days for the trial period $U_License = "3" ; 3 = one computer only - see license notes $D_License = "1" ; developers license # $D_PayPal = "www.paypal.com/my account-link to paypal" ; - paypal link $D_Link = "www.mywebsite.com/.../" ; looks for "www.mywebsite.com/.../Blacklist.txt" ; see Blacklist $U_Return = 1 ; pay or quit .... or $U_Return = 0 ; will return control to developer with @extended = 6 [Limited Freeware Option] XProTec($D_Mail, $D_Program, $U_Price, $U_Trial, $U_License, $D_License, $D_PayPal, $D_Link, $U_Return) ; your script starts here .............. that was silenced at the top of XProtec_Free is to be the clients side to request a code from the smtp server. 2.) The remainder of XProTec is the server side (but fill out with Your own smtp information) I suppose that in the shift from non free to free some people like myself got a little confused. I know non free is no longer supported so does this mean when i use the #include at the top i use XProTec_Free, do i not use one, or do i use the original? Next, (mind i have about 3 smtp serves) how am i suppose to put this exe on my server? do i compile to a php source or html... As i still have many questions i think i need the structure of the current supported Free version explained, not piece by piece but what parts go where kinda thing. Please someone speak up if im totally in the wrong, i would rather know now than to spend months with that mindset and give up. I am going to attempt to respond, however some of the questions are not clear to me. #1 That was silenced in the "DEMO" portion. This must be unsilenced in your script and filled in with YOUR information. Inside the include, you must place YOUR SERVER information...for emailing #2 XProTec has no Client/Server, just an emailer system and an InetGet() to grab a file from a website. (your website) #A Use the free version only. Trash the old version. Place this info at the top of your script... #include<XProTec.au3> ; MUST BE AN INCLUDE $D_Mail = "developer@msn.com " ; your email $D_Program = "My_Program_Name" ; your program name $U_Price = "20.00" ; the amount of money you wish to be payed by the user $U_Trial = "30" ; amount of days for the trial period $U_License = "3" ; 3 = one computer only - see license notes $D_License = "123456789" ; developers license # $D_PayPal = "www.paypal.com/my account-link to paypal" ; - paypal link $D_Link = "www.mywebsite.com/.../" ; looks for "www.mywebsite.com/.../Blacklist.txt" ; see Blacklist $U_Return = 1 ; pay or quit .... or $U_Return = 0 ; will return control to developer with @extended = 6 [Limited Freeware Option] XProTec($D_Mail, $D_Program, $U_Price, $U_Trial, $U_License, $D_License, $D_PayPal, $D_Link, $U_Return) ; your script starts here .............. #B Compile the Script. Be sure to change the name $D_Program = "My_Program_Name" to the name of the compiled program without the "exe" #C This program does not go on a server. it only runs "Inside" your program. You may place a "BLACKLIST.TXT" file on your website if you wish There is no other "what parts go where kinda thing." Hopefully that will clear some things for you. 8) Edited July 18, 2011 by Valuater
hancham Posted August 14, 2011 Posted August 14, 2011 OK so I may be wrong but there is a big part of the page 1 explanation that is not there anymore? because I can`t find any place that actually explain how to use the xprotec, also there is no information at all about how thing turn out about the free code , so I`m pretty much lost here, can anyone please send me a link with the explain PAGE 1?? also if the first xprotec.au3 that is completely encrypted is not being supported and used anymore, why it still at page 1 ? (or we still have to use it ?) thank you sorry if I`m asking anything stupid or I missed something on the 13pages discussion(wich by the is pretty much scattered and confuse)
Valuater Posted August 15, 2011 Author Posted August 15, 2011 (edited) OK so I may be wrong but there is a big part of the page 1 explanation that is not there anymore? because I can`t find any place that actually explain how to use the xprotec, also there is no information at all about how thing turn out about the free code , so I`m pretty much lost here, can anyone please send me a link with the explain PAGE 1?? also if the first xprotec.au3 that is completely encrypted is not being supported and used anymore, why it still at page 1 ? (or we still have to use it ?) thank you sorry if I`m asking anything stupid or I missed something on the 13pages discussion(wich by the is pretty much scattered and confuse)Actually there was an extensive explanation page on the original forum, once transfered here, I can see that much of the info was lost in transition.However, the info given in my previous post above does explain most of the general usage.The old version was left for people who originally paid and still want access to the file.Please don't concern yourself with anything other than the info "you need"8) Edited August 15, 2011 by Valuater
hancham Posted August 16, 2011 Posted August 16, 2011 thank you for reply! there is any record of the original forum page? I would like to see it. Thank you
Valuater Posted August 18, 2011 Author Posted August 18, 2011 ...there is any record of the original forum page? ...Not that I am aware of. Once the server was moved I am pretty sure all was lost. However you can ask Valik, but I don't think there is an value in asking.Sorry,8)
Valuater Posted September 12, 2011 Author Posted September 12, 2011 Thank you teamnugs for the Donation to Autoit!!! hi i just sent you an email also with about the same thing, i just registered(eventhough ive been here) and donated but im still getting the "register developer" tooltips. any ideas? or do i have to wait a little while for it to clear? thanks alot!! To answer yoour question, The "register developer" on the tool-tip in the "free version" should show the Develkopers number that you will use. Thanks again,Valuater8)
teamnugs Posted September 12, 2011 Posted September 12, 2011 (edited) Thank you teamnugs for the Donation to Autoit!!! To answer yoour question, The "register developer" on the tool-tip in the "free version" should show the Develkopers number that you will use. Thanks again,Valuater8) thanks for the reply! so the reg number pops up in the tooltip? i just get the words and when i click on it, it goes away. thanks! Edited September 12, 2011 by teamnugs
teamnugs Posted September 13, 2011 Posted September 13, 2011 i think ive figured it out now! thank you for the help
chrshea Posted September 18, 2011 Posted September 18, 2011 I spent quite a bit of time yesterday and today working with XProTec to get it working. Some of this was just getting the parms set correctly but there were a couple of things that didn't work and needed changes:The mailer wouldn't work (COM error). I found an old post with the same issue suggesting some different mailer code. I turned that into a standalone include and I used it in XProTec.It wouldn't complete the registration process because the literal that it was checking for from PayPal (Thank you for your payment) has been changed to "Thanks for your order". I changed it to check for both and I was then able to successfully run end-to-end.I am breaking out the mailer parms and XProTec parms into separate config files so that all the variables are by themselves and XProTec (and the mailer module) can be generic with no change needed to use it for a different program / developer. There isn't much in the way of documentation for XProTec except for the one post that I found from July of this year but I am going to extract it into a file for reference and I'll add notes on anything else that is worth noting. I haven't tried all of the options yet so I still have some additional testing to do. It isn't my intent to knock XProTec in any way because it's really good work. Commercial programs that do the same sort of things usually have a pretty significant cost. My changes were needed to get it to work for me and to make it a bit more flexible. If anyone is interested in seeing what I've done, I'd be happy to share it (but it isn't complete yet so it won't be immediate). I don't think that I'm repeating anything that's already been done but if I am then I'm sure that someone will point that out. Chris
chrshea Posted September 18, 2011 Posted September 18, 2011 I do have one thing that I need to clarify. Is it correct to assume that XProTec only deals with the licensing but does not do anything to protect the code itself? Am I dependent on the Obfusticator and UPX to make the code less understandable? Chris
Valuater Posted September 19, 2011 Author Posted September 19, 2011 I do have one thing that I need to clarify. Is it correct to assume that XProTec only deals with the licensing but does not do anything to protect the code itself? Am I dependent on the Obfusticator and UPX to make the code less understandable? Chris Thats correct XProTec does not protect the code itself. 8)
czardas Posted September 19, 2011 Posted September 19, 2011 I have looked at this thread previously, but never spent time to study it properly. I'm going to have a play around with it, Thanks for creating it Valuater. operator64 ArrayWorkshop
Chimaera Posted December 6, 2011 Posted December 6, 2011 (edited) Hi Ive had a play with the Free version to create a time trail of 10 days #include<XProTec.au3> ; MUST BE AN INCLUDE $D_Mail = "mymail@live.co.uk " ; your email $D_Program = "Tech V5.06.exe" ; your program name $U_Price = "0.00" ; the amount of money you wish to be payed by the user $U_Trial = "10" ; amount of days for the trial period $U_License = "3" ; 3 = one computer only - see license notes $D_License = "1" ; developers license # $D_PayPal = "www.my website.co.uk" ; ; can this just be my website instead? $D_Link = "www.mywebsite.com" ; ; do i have to create this? as i dont need it $U_Return = 1 ; pay or quit .... or $U_Return = 0 ; will return control to developer with @extended = 6 [Limited Freeware Option] Global $D_Mail, $D_Program, $U_Price, $U_Trial, $U_License, $D_License, $D_PayPal, $D_Link, $U_Return; i had to put this in to stop all the errors i was getting XProTec($D_Mail, $D_Program, $U_Price, $U_Trial, $U_License, $D_License, $D_PayPal, $D_Link, $U_Return) In the end i had to turn this off as well because of the date errors and stuff ;~ #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 I edited this in the xprotec as well Global $smtpserver = "smtp.live.com" Global $sendusername = "my mail@live.co.uk" Global $sendpassword = "*************" I made sure the program name was the same, then i compiled it and everytime i run it i get an error Autoit Error Line 2917 (File "") Error: Duplicate function name. My script only has 700 ish lines and a cple small includes so i have no idea where this is happening All i need it to do is after the trial expires the stop the program working and send them to my website to buy the full one, the trail is a restricted version that cant be upgraded Edited December 6, 2011 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
Valuater Posted December 11, 2011 Author Posted December 11, 2011 I would think if you use the "Syntax check" under "Tools" in the "SciTe editor" ...it should find the duplicated function name and the line number it is on. Then double click on the error code in the bottom window and, the cursor will move to that function/line in the upper screen. 8)
Chimaera Posted December 11, 2011 Posted December 11, 2011 (edited) Hi I couldnt get it to jump around like you mentioned but with a bit of poking about its something to do with the Xprotect free script at this point i think.. Func _NowCalc() Return (@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC) EndFunc ;==>_NowCalc The error is C:Program Files (x86)AutoIt3IncludeDate.au3(1233,16) : ERROR: _NowCalc() already defined. Func _NowCalc() If i hide the xprotec header everything works fine but with it in it throws the error, i have Date as an include in my script because i use this once to get the date _NowDate() Im using latest Beta btw Hope this helps Thanks Edited December 11, 2011 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
guinness Posted December 11, 2011 Posted December 11, 2011 Chimaera, Remove all the functions below _StringEncryptor() (not including that function though) as these are already in Date.au3 and are causing the errors. This is only if you're using XProTec_Free.au3. Unless you've merged it into your main script? Then just delete all the functions that show in the SciTE console window it should say "ERROR: FUNCTIONNAME() already defined." UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Chimaera Posted December 11, 2011 Posted December 11, 2011 (edited) Ok what happens to the bits in the functions? I havent merged it btw expandcollapse popupFunc _NowCalc() Return (@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC) EndFunc ;==>_NowCalc Func _DateTimeFormat($sDate, $sType) Local $asDatePart[4] Local $asTimePart[4] Local $sTempDate = "" Local $sTempTime = "" Local $sAM Local $sPM Local $iWday Local $lngX If Not _DateIsValid($sDate) Then SetError(1) Return ("") EndIf If $sType < 0 Or $sType > 5 Or Not IsInt($sType) Then SetError(2) Return ("") EndIf _DateTimeSplit($sDate, $asDatePart, $asTimePart) Switch $sType Case 0 $lngX = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", 0x400, "long", 0x1F, "str", "", "long", 255) If Not @error And $lngX[0] <> 0 Then $sTempDate = $lngX[3] Else $sTempDate = "M/d/yyyy" EndIf If $asTimePart[0] > 1 Then $lngX = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", 0x400, "long", 0x1003, "str", "", "long", 255) If Not @error And $lngX[0] <> 0 Then $sTempTime = $lngX[3] Else $sTempTime = "h:mm:ss tt" EndIf EndIf Case 1 $lngX = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", 0x400, "long", 0x20, "str", "", "long", 255) If Not @error And $lngX[0] <> 0 Then $sTempDate = $lngX[3] Else $sTempDate = "dddd, MMMM dd, yyyy" EndIf Case 2 $lngX = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", 0x400, "long", 0x1F, "str", "", "long", 255) If Not @error And $lngX[0] <> 0 Then $sTempDate = $lngX[3] Else $sTempDate = "M/d/yyyy" EndIf Case 3 If $asTimePart[0] > 1 Then $lngX = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", 0x400, "long", 0x1003, "str", "", "long", 255) If Not @error And $lngX[0] <> 0 Then $sTempTime = $lngX[3] Else $sTempTime = "h:mm:ss tt" EndIf EndIf Case 4 If $asTimePart[0] > 1 Then $sTempTime = "hh:mm" EndIf Case 5 If $asTimePart[0] > 1 Then $sTempTime = "hh:mm:ss" EndIf EndSwitch If $sTempDate <> "" Then $lngX = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", 0x400, "long", 0x1D, "str", "", "long", 255) If Not @error And $lngX[0] <> 0 Then $sTempTime = StringReplace($sTempTime, "/", $lngX[3]) EndIf $iWday = _DateToDayOfWeek($asDatePart[1], $asDatePart[2], $asDatePart[3]) $asDatePart[3] = StringRight("0" & $asDatePart[3], 2) $asDatePart[2] = StringRight("0" & $asDatePart[2], 2) $sTempDate = StringReplace($sTempDate, "d", "@") $sTempDate = StringReplace($sTempDate, "m", "#") $sTempDate = StringReplace($sTempDate, "y", "&") $sTempDate = StringReplace($sTempDate, "@@@@", _DateDayOfWeek($iWday, 0)) $sTempDate = StringReplace($sTempDate, "@@@", _DateDayOfWeek($iWday, 1)) $sTempDate = StringReplace($sTempDate, "@@", $asDatePart[3]) $sTempDate = StringReplace($sTempDate, "@", StringReplace(StringLeft($asDatePart[3], 1), "0", "") & StringRight($asDatePart[3], 1)) $sTempDate = StringReplace($sTempDate, "####", _DateMonthOfYear($asDatePart[2], 0)) $sTempDate = StringReplace($sTempDate, "###", _DateMonthOfYear($asDatePart[2], 1)) $sTempDate = StringReplace($sTempDate, "##", $asDatePart[2]) $sTempDate = StringReplace($sTempDate, "#", StringReplace(StringLeft($asDatePart[2], 1), "0", "") & StringRight($asDatePart[2], 1)) $sTempDate = StringReplace($sTempDate, "&&&&", $asDatePart[1]) $sTempDate = StringReplace($sTempDate, "&&", StringRight($asDatePart[1], 2)) EndIf If $sTempTime <> "" Then $lngX = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", 0x400, "long", 0x28, "str", "", "long", 255) If Not @error And $lngX[0] <> 0 Then $sAM = $lngX[3] Else $sAM = "AM" EndIf $lngX = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", 0x400, "long", 0x29, "str", "", "long", 255) If Not @error And $lngX[0] <> 0 Then $sPM = $lngX[3] Else $sPM = "PM" EndIf $lngX = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", 0x400, "long", 0x1E, "str", "", "long", 255) If Not @error And $lngX[0] <> 0 Then $sTempTime = StringReplace($sTempTime, ":", $lngX[3]) EndIf If StringInStr($sTempTime, "tt") Then If $asTimePart[1] < 12 Then $sTempTime = StringReplace($sTempTime, "tt", $sAM) If $asTimePart[1] = 0 Then $asTimePart[1] = 12 Else $sTempTime = StringReplace($sTempTime, "tt", $sPM) If $asTimePart[1] > 12 Then $asTimePart[1] = $asTimePart[1] - 12 EndIf EndIf $asTimePart[1] = StringRight("0" & $asTimePart[1], 2) $asTimePart[2] = StringRight("0" & $asTimePart[2], 2) $asTimePart[3] = StringRight("0" & $asTimePart[3], 2) $sTempTime = StringReplace($sTempTime, "hh", StringFormat( "%02d", $asTimePart[1])) $sTempTime = StringReplace($sTempTime, "h", StringReplace(StringLeft($asTimePart[1], 1), "0", "") & StringRight($asTimePart[1], 1)) $sTempTime = StringReplace($sTempTime, "mm", StringFormat( "%02d", $asTimePart[2])) $sTempTime = StringReplace($sTempTime, "ss", StringFormat( "%02d", $asTimePart[3])) $sTempDate = StringStripWS($sTempDate & " " & $sTempTime, 3) EndIf Return ($sTempDate) EndFunc ;==>_DateTimeFormat Func _DateDiff($sType, $sStartDate, $sEndDate) Local $asStartDatePart[4] Local $asStartTimePart[4] Local $asEndDatePart[4] Local $asEndTimePart[4] Local $iTimeDiff Local $iYearDiff Local $iMonthDiff Local $iStartTimeInSecs Local $iEndTimeInSecs Local $aDaysDiff $sType = StringLeft($sType, 1) If StringInStr("d,m,y,w,h,n,s", $sType) = 0 Or $sType = "" Then SetError(1) Return (0) EndIf If Not _DateIsValid($sStartDate) Then SetError(2) Return (0) EndIf If Not _DateIsValid($sEndDate) Then SetError(3) Return (0) EndIf _DateTimeSplit($sStartDate, $asStartDatePart, $asStartTimePart) _DateTimeSplit($sEndDate, $asEndDatePart, $asEndTimePart) $aDaysDiff = _DateToDayValue($asEndDatePart[1], $asEndDatePart[2], $asEndDatePart[3]) - _DateToDayValue($asStartDatePart[1], $asStartDatePart[2], $asStartDatePart[3]) If $asStartTimePart[0] > 1 And $asEndTimePart[0] > 1 Then $iStartTimeInSecs = $asStartTimePart[1] * 3600 + $asStartTimePart[2] * 60 + $asStartTimePart[3] $iEndTimeInSecs = $asEndTimePart[1] * 3600 + $asEndTimePart[2] * 60 + $asEndTimePart[3] $iTimeDiff = $iEndTimeInSecs - $iStartTimeInSecs If $iTimeDiff < 0 Then $aDaysDiff = $aDaysDiff - 1 $iTimeDiff = $iTimeDiff + 24 * 60 * 60 EndIf Else $iTimeDiff = 0 EndIf Select Case $sType = "d" Return ($aDaysDiff) Case $sType = "m" $iYearDiff = $asEndDatePart[1] - $asStartDatePart[1] $iMonthDiff = $asEndDatePart[2] - $asStartDatePart[2] + $iYearDiff * 12 If $asEndDatePart[3] < $asStartDatePart[3]Then $iMonthDiff = $iMonthDiff - 1 $iStartTimeInSecs = $asStartTimePart[1] * 3600 + $asStartTimePart[2] * 60 + $asStartTimePart[3] $iEndTimeInSecs = $asEndTimePart[1] * 3600 + $asEndTimePart[2] * 60 + $asEndTimePart[3] $iTimeDiff = $iEndTimeInSecs - $iStartTimeInSecs If $asEndDatePart[3] = $asStartDatePart[3]And $iTimeDiff < 0 Then $iMonthDiff = $iMonthDiff - 1 Return ($iMonthDiff) Case $sType = "y" $iYearDiff = $asEndDatePart[1] - $asStartDatePart[1] If $asEndDatePart[2] < $asStartDatePart[2]Then $iYearDiff = $iYearDiff - 1 If $asEndDatePart[2] = $asStartDatePart[2]And $asEndDatePart[3] < $asStartDatePart[3]Then $iYearDiff = $iYearDiff - 1 $iStartTimeInSecs = $asStartTimePart[1] * 3600 + $asStartTimePart[2] * 60 + $asStartTimePart[3] $iEndTimeInSecs = $asEndTimePart[1] * 3600 + $asEndTimePart[2] * 60 + $asEndTimePart[3] $iTimeDiff = $iEndTimeInSecs - $iStartTimeInSecs If $asEndDatePart[2] = $asStartDatePart[2]And $asEndDatePart[3] = $asStartDatePart[3]And $iTimeDiff < 0 Then $iYearDiff = $iYearDiff - 1 Return ($iYearDiff) Case $sType = "w" Return (Int($aDaysDiff / 7)) Case $sType = "h" Return ($aDaysDiff * 24 + Int($iTimeDiff / 3600)) Case $sType = "n" Return ($aDaysDiff * 24 * 60 + Int($iTimeDiff / 60)) Case $sType = "s" Return ($aDaysDiff * 24 * 60 * 60 + $iTimeDiff) EndSelect EndFunc ;==>_DateDiff Func _DateIsValid($sDate) Local $asDatePart[4] Local $asTimePart[4] Local $iNumDays $iNumDays = "31,28,31,30,31,30,31,31,30,31,30,31" $iNumDays = StringSplit($iNumDays, ",") _DateTimeSplit($sDate, $asDatePart, $asTimePart) If $asDatePart[0] <> 3 Then Return (0) EndIf If _DateIsLeapYear($asDatePart[1]) Then $iNumDays[2] = 29 If $asDatePart[1] < 1000 Or $asDatePart[1] > 2999 Then Return (0) If $asDatePart[2] < 1 Or $asDatePart[2] > 12 Then Return (0) If $asDatePart[3] < 1 Or $asDatePart[3] > $iNumDays[$asDatePart[2]]Then Return (0) If $asTimePart[0] < 1 Then Return (1) If $asTimePart[0] < 2 Then Return (0) If $asTimePart[1] < 0 Or $asTimePart[1] > 23 Then Return (0) If $asTimePart[2] < 0 Or $asTimePart[2] > 59 Then Return (0) If $asTimePart[3] < 0 Or $asTimePart[3] > 59 Then Return (0) Return (1) EndFunc ;==>_DateIsValid Func _DateTimeSplit($sDate, ByRef $asDatePart, ByRef $iTimePart) Local $sDateTime Local $x $sDateTime = StringSplit($sDate, " T") If $sDateTime[0] > 0 Then $asDatePart = StringSplit($sDateTime[1], "/-.") If $sDateTime[0] > 1 Then $iTimePart = StringSplit($sDateTime[2], ":") If UBound($iTimePart) < 4 Then ReDim $iTimePart[4] Else Dim $iTimePart[4] EndIf If UBound($asDatePart) < 4 Then ReDim $asDatePart[4] For $x = 1 To 3 $asDatePart[$x] = Number($asDatePart[$x]) $iTimePart[$x] = Number($iTimePart[$x]) Next Return (1) EndFunc ;==>_DateTimeSplit Func _DateToDayOfWeek($iYear, $iMonth, $iDay) Local $i_aFactor Local $i_yFactor Local $i_mFactor Local $i_dFactor If Not _DateIsValid($iYear & "/" & $iMonth & "/" & $iDay) Then SetError(1) Return ("") EndIf $i_aFactor = Int((14 - $iMonth) / 12) $i_yFactor = $iYear - $i_aFactor $i_mFactor = $iMonth + (12 * $i_aFactor) - 2 $i_dFactor = Mod($iDay + $i_yFactor + Int($i_yFactor / 4) - Int($i_yFactor / 100) + Int($i_yFactor / 400) + Int((31 * $i_mFactor) / 12), 7) return ($i_dFactor + 1) EndFunc ;==>_DateToDayOfWeek Func _DateDayOfWeek($iDayNum, $iShort = 0) Local $aDayOfWeek[8] $aDayOfWeek[1] = "Sunday" $aDayOfWeek[2] = "Monday" $aDayOfWeek[3] = "Tuesday" $aDayOfWeek[4] = "Wednesday" $aDayOfWeek[5] = "Thursday" $aDayOfWeek[6] = "Friday" $aDayOfWeek[7] = "Saturday" Select Case Not StringIsInt($iDayNum) Or Not StringIsInt($iShort) SetError(1) Return "" Case $iDayNum < 1 Or $iDayNum > 7 SetError(1) Return "" Case Else Select Case $iShort = 0 Return $aDayOfWeek[$iDayNum] Case $iShort = 1 Return StringLeft($aDayOfWeek[$iDayNum], 3) Case Else SetError(1) Return "" EndSelect EndSelect EndFunc ;==>_DateDayOfWeek Func _DateMonthOfYear($iMonthNum, $iShort) Local $aMonthOfYear[13] $aMonthOfYear[1] = "January" $aMonthOfYear[2] = "February" $aMonthOfYear[3] = "March" $aMonthOfYear[4] = "April" $aMonthOfYear[5] = "May" $aMonthOfYear[6] = "June" $aMonthOfYear[7] = "July" $aMonthOfYear[8] = "August" $aMonthOfYear[9] = "September" $aMonthOfYear[10] = "October" $aMonthOfYear[11] = "November" $aMonthOfYear[12] = "December" Select Case Not StringIsInt($iMonthNum) Or Not StringIsInt($iShort) SetError(1) Return "" Case $iMonthNum < 1 Or $iMonthNum > 12 SetError(1) Return "" Case Else Select Case $iShort = 0 Return $aMonthOfYear[$iMonthNum] Case $iShort = 1 Return StringLeft($aMonthOfYear[$iMonthNum], 3) Case Else SetError(1) Return "" EndSelect EndSelect EndFunc ;==>_DateMonthOfYear Func _DateToDayValue($iYear, $iMonth, $iDay) Local $i_aFactor Local $i_bFactor Local $i_cFactor Local $i_eFactor Local $i_fFactor Local $iJulianDate If Not _DateIsValid(StringFormat( "%04d/%02d/%02d", $iYear, $iMonth, $iDay)) Then SetError(1) Return ("") EndIf If $iMonth < 3 Then $iMonth = $iMonth + 12 $iYear = $iYear - 1 EndIf $i_aFactor = Int($iYear / 100) $i_bFactor = Int($i_aFactor / 4) $i_cFactor = 2 - $i_aFactor + $i_bFactor $i_eFactor = Int(1461 * ($iYear + 4716) / 4) $i_fFactor = Int(153 * ($iMonth + 1) / 5) $iJulianDate = $i_cFactor + $iDay + $i_eFactor + $i_fFactor - 1524.5 return ($iJulianDate) EndFunc ;==>_DateToDayValue Func _DateIsLeapYear($iYear) If StringIsInt($iYear) Then Select Case Mod($iYear, 4) = 0 And Mod($iYear, 100) <> 0 Return 1 Case Mod($iYear, 400) = 0 Return 1 Case Else Return 0 EndSelect Else SetError(1) Return 0 EndIf EndFunc ;==>_DateIsLeapYear This is everything from the _StringEncryptor() to the bottom Edited December 11, 2011 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
guinness Posted December 11, 2011 Posted December 11, 2011 These are included in Date.au3 so just delete it from the XProTec UDF. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
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